Understanding Docker can be difficult or time-consuming. In order to spread knowledge about Cloud technologies I started to create sketchnotes about Docker. I think it could be a good way, more visual, to explain Docker (and other technologies like Kubernetes and Istio).
We continue the series of Docker sketchnotes with a focus about how to pass environment variables.
As usual, if you like theses sketchnotes, you can follow me, and tell me what do you think. I will publish others sketchs shortly :-).
If you are interested, I published all the sketchnotes on Docker (and new ones!) to make a "book" of 93 pages: "Understanding Docker in a visual way".
Top comments (4)
Interesting!! I have bought your two sketch notes before, they are very useful. For this post, I have 2 questions:
And I think you can use this sketch note above for docker-compose, just modify a bit.
Finally it is better if you can share: what should be the recommended way for user!? (For my I prefer declare environments variable to a file)
Hi
Thanks bugb :)
About the question about the software, I use a samsung tablet with samsung note app, so I sketch with a pencil myself :).
About the question "what happens if I pass an environment with three different value based on 3 ways above (which one should be the last value of the variable)?":
I tested it and here the result:
$ cat myfile.env
ENV=int2
$ docker run --env-file=myfile.env mygolang:test
hello
ENV=int2
$ docker run -e ENV="int1" --env-file=myfile.env mygolang:test
ENV=int1
$ docker run --env-file=myfile.env -e ENV="int1" mygolang:test
hello
ENV=int1
--> if you pass environment variables through -e and --env-file, then finally the env value is passed through -e, but not the one in env-file ;)
The recommended way for the user, as usually: it depends!
You can pass environment values through your CI/CD toolchain for example, in your job you can add parameter and pass the region and/or the environment to the docker run command.
Or an environment file can be create and pass depending on the target environment.
It really depends on the context of your team, your project... :)
And I added a third page of this sketchnotes thanks to your remark 😀
Very nice way of presenting things ❤️