Docker networking
I was trying to do some tuning on my servers network, but while I was at that I realized I couldn’t do it because I didn’t know anything about how Docker does networking. Since I need to move forward with my network configuration, I’m writing this article in the hope of understanding it better.
There are three networks automatically created by the Docker daemon when it starts: bridge, host and none. In this article I’m going to cover the bridge network since it is the default and most flexible one. You can see the networks using docker network ls:
1
2
3
4
NETWORK ID NAME DRIVER
d8a90e633c4a bridge bridge
b342b31dab76 host host
48ac37e62c31 none null
You will also see the bridge network interface created by Docker when running ifconfig:
1
2
3
4
5
6
7
8
docker0 Link encap:Ethernet HWaddr 05:42:37:b5:36:7a
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:47ff:feb5:867a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:221192 errors:0 dropped:0 overruns:0 frame:0
TX packets:199761 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:69251108 (69.2 MB) TX bytes:205171116 (205.1 MB)