Each of these softwares is broken down into microservices and then packaged as containers.
Software can have a multitude of purposes, from possibly simple text processing to a full web server, hosting your private files. How docker containers communicate?ĭocker is a tool for packaging and delivering software to the masses using containerization technology. I'll explain that to you in the next section followed by some other methods of getting the IP address of a running docker container. To understand that, you need to understand how containers communicate with each other. You may also use grep command to get just the lines matching the string "IPAddress".ĭon't be alarmed if your container has more than one IP address. Go towards the end and look into the Networks section to get the container's IP address. The inspect command gives you many details about the container you are inspecting. Now it's accessible from the outside.Don't know the container's name or ID? Use the command sudo docker ps.
Now with the -p option I'm mapping the port 8080 of my bridge network on 8888 of my host network: so host-IP:8888. So my container is running in the bridge network on 172.17.0.4:8080. When I perform a docker inspect I see: "IPAddress": "172.17.0.4", So for the jenkins example: $ docker run -d -p 8888:8080 jenkins To access the container from the outside you have to map your ports on your host network (see the more info). Now your container will get an IP from in the range of that network. If you leave the -net host option, the container will be created in the default docker bridge network with range "172.17.0.0/16". It's running on your host network and host IP. I go in my browser to 192.168.140.7:8080 and I see the jenkins. I check the real IP of my eth0 (host network) with ifconfig. So I open the firewall: $ sudo iptables -I INPUT 5 -p tcp -m tcp -dport 8080 -j ACCEPT So when you open the firewall (jenkins runs on 8080) you will access your container immediatly. This will run jenkins on your real host network. So your container will be accessible on the IP of your host.Ī very basic example: $ docker run -net=host -d jenkins You are starting your container with the -net host option which means your container will run on your host network. "SandboxKey": "/var/run/docker/netns/default", "RETHINKDB_PACKAGE_VERSION=2.3.5~0jessie" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", Why doesn't this container have any IP address? I checked if the rethinkDB configuration page is up or not by going to and I see it's up and running.
I couldn't find IP address for this container. So I did docker inspect -format '' f288961ef376 Now I want to find out the IP address of this container. " 9 minutes ago Up 9 minutes rethinkdbġf71722698ae sorccu/adb:latest "/sbin/tini - adb." 14 minutes ago Up 14 minutes adbd I did docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESį288961ef376 rethinkdb:2.3 "rethinkdb -bind. I started a rethinkDB docker container using the command docker pull rethinkdb:2.3ĭocker run -rm -name rethinkdb -v /srv/rethinkdb:/data -net host rethinkdb:2.3 rethinkdb -bind all -cache-size 8192 -no-update-check