3- docker networking
https://docs.docker.com/engine/userguide/networking/work-with-networks/
docker network create
docker network connect
docker network ls
docker network rm
docker network disconnect
docker network inspect
root@docker-lab:~# docker network ls
NETWORK ID NAME DRIVER SCOPE
9e03390fb21c bridge bridge local
e5e97a139009 host host local
5bef5aca2df3 none null local
root@docker-lab:~# docker network inspect bridge
[
{
"Name": "bridge",
"Id": "9e03390fb21c0efab23e50a8b2295c427e9a460c1868c59f6812ff13f6ef8e4e",
"Created": "2017-06-19T11:44:18.245942413Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"Containers": {
" 2fcc10438986c814fbeec78bb9406b1dcd9795260eee4833dfff8964ddbcd50c": {
"Name": "modest_almeida",
"EndpointID": "7a2ac0f8c10839f9d8250704be1e2618d62d950b728af2d3283e5cc41f1f95e8",
"MacAddress": "02:42:ac:11:00:03",
"IPv4Address": "172.17.0.3/16",
"IPv6Address": ""
},
"3b91a1b0e9576a66de5e63146ed57e4d03b1be1453c3065cf6a9eed41719e368": {
"Name": "dbms",
"EndpointID": "4aaff344733f41b6ed101b2ffb27f6c935b4a2b932e7165454272ab278b385fb",
"MacAddress": "02:42:ac:11:00:04",
"IPv4Address": "172.17.0.4/16",
"IPv6Address": ""
},
"a352aa3463f0f17f2e0a0804d6bc37089832fc06d6752b4f0250619254bd9872": {
"Name": "website",
"EndpointID": "9979fd7e8fcb872e0584434fddf8bec679c39f20446bdd92cf1a7bdd49b53e64",
"MacAddress": "02:42:ac:11:00:05",
"IPv4Address": "172.17.0.5/16",
"IPv6Address": ""
},
"c67deae3fe5ccd7d225924829506a013338606d72f6adc0466daeaaee2231f0d": {
"Name": "ubuntu1",
"EndpointID": "44cfbdb45f3707aaf32e2620f5ffa2341abd203050aa57f16f8068f0b83eed2a",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
root@docker-lab:~#
root@docker-lab:~# ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:6a:81:de:b0
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:6aff:fe81:deb0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:22 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2472 (2.4 KB) TX bytes:3116 (3.1 KB)
eth0 Link encap:Ethernet HWaddr 06:7f:0a:fd:fe:70
inet addr:10.48.0.26 Bcast:10.48.0.255 Mask:255.255.255.0
inet6 addr: fe80::47f:aff:fefd:fe70/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:306686 errors:0 dropped:0 overruns:0 frame:0
TX packets:20178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:446302207 (446.3 MB) TX bytes:1665651 (1.6 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
veth124a8a6 Link encap:Ethernet HWaddr 52:f5:99:ff:de:f3
inet6 addr: fe80::50f5:99ff:feff:def3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:476 (476.0 B) TX bytes:1178 (1.1 KB)
veth1c7907b Link encap:Ethernet HWaddr d6:ae:c7:5c:95:c8
inet6 addr: fe80::d4ae:c7ff:fe5c:95c8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:1434 (1.4 KB)
veth5d36805 Link encap:Ethernet HWaddr 1a:ef:0e:5d:ea:c7
inet6 addr: fe80::18ef:eff:fe5d:eac7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:476 (476.0 B) TX bytes:1178 (1.1 KB)
veth76f09f4 Link encap:Ethernet HWaddr 7e:9f:ff:12:b1:51
inet6 addr: fe80::7c9f:ffff:fe12:b151/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2738 (2.7 KB) TX bytes:3158 (3.1 KB)
root@docker-lab:~#