I want to create a docker container with a Dockerfile, Compose.yaml and a .env file. In the Dockerfile I create a image based on python, the Dockerfile:
FROM python:3
RUN mkdir -p /share_data/
COPY main.py .
The .env file:
VOLUME_PATH=/home/monetillo/Documents/test
CONTAINER_NAME=sort_algorithm_docker
CONFIGURATION_PATH=/share_data/configuration.json
The Compose.yaml:
version: '3.8'
services:
sort_algorithm:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
volumes:
- ${VOLUME_PATH}:/share_data # Mount host directory to container directory
command: python main.py ${CONFIGURATION_PATH}
When i do: docker compose build
, I have this error:
no configuration file provided: not found
The file exists and it is inside the volume_path. I also try to change the CONFIGURATION_PATH to /home/monetillo/Documents/test/configuration.json
To sump up, what i want is in the command part pass a file that is inside the volume. Is there any way to do this?
Thanks in advance