interface docker
# docker network create --driver bridge blue
1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b
# docker network inspect blue
[
{
"Name": "blue",
"Id": "1196a4c5af43a21ae38ef34515b6af19236a3fc48122cf585e3f3054d509679b",
"Scope": "local",
"Driver": "bridge",
"IPAM": {
"Driver": "default",
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1/16"
}
]
},
"Containers": {},
"Options": {},
"Labels": {}
}
]
# docker run -it --name blue1 --network blue debian /bin/bash
# docker run -it --name blue2 --network blue debian /bin/bash
# docker network inspect blue
[
{
"Name": "blue",
"Id": "2c601356b5d51f3044518bca70c5bc016b2e0a0ccb28475a098185d831c4f27c",
"Created": "2017-06-07T12:50:24.911280255+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Containers": {
"1d105c8c8ab5e84c5cc0e7fac6c57946acc3501c2e9ac202d4a1709a3ab6bd26": {
"Name": "blue1",
"EndpointID": "47d0c1a4041b76123ccfa16a94a2a4211b56c1255c52d670091b8dedcf15241c",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
},
"feb6d086c7813c621218bed5bda2436cc039c7e30f88e04b39ec669bd95f530c": {
"Name": "blue2",
"EndpointID": "cf2c8d36398b0b73920c522efaa3f4c22aa81e02053d882998b3d9d271fe4f11",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
# docker attach blue2
root@1d105c8c8ab5:/#
root@feb6d086c781:/# apt-get install dnsutils
root@feb6d086c781:/# dig
; <<>> DiG 9.9.5-9+deb8u11-Debian <<>>
;; global options: +cmd
......
. 119855 IN NS k.root-servers.net.
. 119855 IN NS l.root-servers.net.
. 119855 IN NS m.root-servers.net.
;; Query time: 64 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Thu Jun 08 08:02:44 UTC 2017
;; MSG SIZE rcvd: 239
dig blue1
; <<>> DiG 9.9.5-9+deb8u11-Debian <<>> blue1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63460
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;blue1. IN A
;; ANSWER SECTION:
blue1. 600 IN A 172.18.0.2
;; Query time: 0 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Thu Jun 08 08:03:21 UTC 2017
;; MSG SIZE rcvd: 44
root@feb6d086c781:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0