I have issues addressing container in my docker network. I understand the different kinds of networks like overlay, bridge, networks. But I don't understand how to make my container talk to each other.
Practical example: I have a web server. There are two docker container on my web server. The first one holds nginx. The second one an instance of gitlab.
I need to point nginx with the proxy_pass variable to my gitlab container.
Here are the two ways I know how to do it:
- I add links to my docker container. Docker deprecated those, so that's not an option.
- I am using a dnsdock. I am using aacebedo's dnsdock docker. It allows me to provide container with dns resolvable names by giving them the
com.dnsdock.alias
flag.
Is that the normal way of doing it? Is there not some better integrated way of solving that issue without adding a dns server to the network?
I think I figured out the canonical answer.
Now docker will resolve them via the net-alias. As an added bonus, this probably allows for hassle-free overlay networking between servers. But I haven't tested it, so don't nail me down on this.