Haxxnet / Compose-Examples

Various Docker Compose examples of selfhosted FOSS and proprietary projects.

Home Page:https://haxxnet.github.io/Compose-Examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions about creating networks and global environment variables

sofakng opened this issue · comments

Hey, thanks for these great examples (and for answers so many questions on Reddit), but I had another two questions:

  1. How do you create your Docker networks? (ie. proxy network)

In your Traefik example, it looks you like you are using an external 'proxy' network. Do you manually create this using the command-line or use a more convenient way? (ie. script)

Also, the Traefik example specifies host.docker.internal as 172.17.0.1 but that's the Docker system bridge network. Should this be 172.18.0.1 (or whatever your created network ip address is?)

  1. Where do you define your global environment variables? (ie. ${DOCKER_VOLUME_STORAGE})

I know you can create a .env file inside each Docker compose folder but that's a ton of duplication. I'm thinking you have to define it inside your user profile but that's a bit messy?

Thanks for the help!

commented

How do you create your Docker networks? (ie. proxy network)

Basically just a matter of:

docker network create proxy

Also, the Traefik example specifies host.docker.internal as 172.17.0.1 but that's the Docker system bridge network. Should this be 172.18.0.1 (or whatever your created network ip address is?)

You'll come up with this 'fix' at several points when using Traefik. For example, when you want to spawn home assisstant and using the host network. I would have to look it up again in detail, why it's necessary. If I remember correctly, it's an additional link to your docker host server by using the default docker bridge network 172.17.0.1.

However, you should leave it as is or remove it totally. You'll notice it, as soon as you need it. No harm in leaving as is. No change needed.

Where do you define your global environment variables? (ie. ${DOCKER_VOLUME_STORAGE})

I personally do not change it at all, as its my default storage path.

However, if you want to change it, you would typically export the env via your terminal. As this would be an annoying manual task each time, I recommend setting it either on your bash profile or .bashrc.