Docker Community Forums

Share and learn in the Docker community.

Using docker network find IP of another container


(Ninjonxb) #1

I am still new to docker and mostly experimenting right now.
Instead of jumping into setting up a production environment I am working on using docker with jenkins to spin up slaves as needed in pipelines.

The point I am at now is I am spinning up 3 containers, all attached to a network “test_pipeline-6” (6 being the current build number).

I have managed to get the containers to be spun up by jenkins and connected to the network.
What I can’t figure out is if there is anything built in for from one container within the network to be able to communicate to another container in the network without knowing the IP address, or if there are other options.
I know I can find this information by running
docker network inspect test_pipeline-6

OS: Debian 8.5
Docker Version: 1.12.1, build 23cf638


(Nathan Le Claire) #2

If the containers are on the same docker network they can use DNS entry based on container name to find each other. So that if a container is named foo1, another container on that network named foo2 can just wget foo1 or whatever and vice versa. Look in /etc/resolv.conf, Docker daemon is functioning as a DNS server.