How do I pass environment variables to Docker containers?

前端 未结 14 1408
独厮守ぢ
独厮守ぢ 2020-11-22 11:15

I\'m new to Docker, and it\'s unclear how to access an external database from a container. Is the best way to hard-code in the connection string?

# Dockerfil         


        
14条回答
  •  情深已故
    2020-11-22 11:34

    The problem I had was that I was putting the --env-file at the end of the command

    docker run -it --rm -p 8080:80 imagename --env-file ./env.list
    

    Fix

    docker run --env-file ./env.list -it --rm -p 8080:80 imagename
    

提交回复
热议问题