You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Aleksey Zubakov ad77de3670 Add docker practice 2 years ago
..
Dockerfile Add docker practice 2 years ago
README.md Add docker practice 2 years ago
demo.sh Add docker practice 2 years ago
file.env Add docker practice 2 years ago

README.md

Lesson 6: Environment variables and configuration

  1. Change directory into lesson06.

  2. A popular way to provide configuration information to a docker container is via environment variables.

  3. Let's try it:

     $ docker build . -t demo
     $ docker run -it --rm --name fuzzle demo
    
  4. Does the output make sense?

  5. Let's pass in a value for the environment variable HELLO_WORLD:

     $ docker run -it --rm --name fuzzle -e HELLO_WORLD='Hello, world.' demo
    
  6. You can also pass in environment variables via a file:

     $ cat file.env
     # We define two environment variables (you CAN comment!)
     HELLO_WORLD="Hello, world."
     ENV_VAR2="another environment variable"
    
     $ docker run -it --rm --name fuzzle --env-file=file.env demo
    
  7. If your Docker application does not have many configuration options configuring via environment variables is a good method. However, if the application has complicated or extnesive configuration this may not be feasible.

  8. Don't forget to clean up:

     $ docker rmi demo:latest (removes the image demo:latest)