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... :)
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 😀