Is it possible to use the environment variables defined in docker-compose.yaml in a Dockerfile?
Example
docker-compose.yaml:
my:
…environment:
…MY_PATH=/foo/bar
Dockerfile:
RUN mkdir ${MY_PATH}
Share and learn in the Docker community.
Is it possible to use the environment variables defined in docker-compose.yaml in a Dockerfile?
Example
docker-compose.yaml:
my:
…environment:
…MY_PATH=/foo/bar
Dockerfile:
RUN mkdir ${MY_PATH}
Use environment to add environment variables. Alternatively add variables from a file env_file.
https://docs.docker.com/v1.8/compose/yml/#environment
Tou can do that with ARG in Dockerfile and args in docker-compose.yml. Please check https://docs.docker.com/compose/compose-file/#args