Docker - Define environment variables in a container using the docker run -e or --env command

This  assumes you have installed Docker on Linux and Docker is running.

The -e or --env option can be used to define environment variables. In this example, when using the docker run command to create snd start the Hello world container,  the "foo" variable contains a value of "bar". This assumes that the Hello world service is configured to use the foo variable. 

docker run --env foo=bar hello-world

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 8c0a5 in the box below so that we can be sure you are a human.