So, although our containers can get out onto the web, no incoming traffic can reach our containers. The firewall on your host machine, by default, blocks all incoming traffic. This bridge network is automatically attached to the ethernet interface of your host machine so that containers can reach the larger network. When you start a new container and do not specify a network, it is attached to this virtual network. So what is going on here?ĭocker has a default virtual network called the bridge network (identified as docker0). You should be able to see that the IP address of your container is not the same as your host machine. You can re use this command with format option to pull any information from a Docker inspect output but in this case we want the IP address from the network settings.ĭocker container inspect -format "" testwebhost You could simply run docker container inspect and search through the output for the IP address. We can test this using a Docker inspect command. What about the container’s IP address? You may think that containers use the same IP address as the host machine but that is not the case. You should now see that port 80 of your host is forwarding traffic to port 80 of the container. We can now list our port mappings for that container using: Let’s start off with a basic Docker command to run an nginx:apline web server container and forward traffic from port 80 of our host machine into port 80 of our container:ĭocker container run -p 80:80 -name testwebhost -d nginx:alpine Some basic understanding of networking (Nice to have, but not required).In this blog post, we are going to dive into Docker networking and see what is going on in the background and why it is important. Docker utilizes a “batteries included, but replaceable” architecture meaning that the default network your containers connect to works well in many cases but can also be replaced with a custom network. When you start a container, you are also connecting to a specific Docker network. Well, if cavemen had computers of course. Spinning up a Docker container is so simple that a caveman could do it.