How do I pass environment variables to Docker containers?

前端 未结 14 1409
独厮守ぢ
独厮守ぢ 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:39

    Another way is to use the powers of /usr/bin/env:

    docker run ubuntu env DEBUG=1 path/to/script.sh
    

提交回复
热议问题