I am working on a simple Docker image that has a large number of environment variables. Are you able to import an environment variable file like with docker-compose? I canno
I really like @halfers approach, but this could also work. docker run
takes an optional parameter called --env-file
which is super helpful.
So your docker file could look like this.
COPY .env .env
and then in a build script use:
docker build -t my_docker_image . && docker run --env-file .env my_docker_image