[root@ip-172-31-40-217 ~]# docker network ls
NETWORK ID NAME DRIVER SCOPE
39450de642d6 bridge bridge local
f6345e9bd840 host host local
514a936c83c1 none null local
[root@ip-172-31-40-217 ~]# docker network inspect bridge
NETWORK ID NAME DRIVER SCOPE
39450de642d6 bridge bridge local
f6345e9bd840 host host local
514a936c83c1 none null local
[root@ip-172-31-40-217 ~]# docker network inspect bridge
"Containers": {}, -----no container attached till now to bridge network
[root@ip-172-31-40-217 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@ip-172-31-40-217 ~]#
[root@ip-172-31-40-217 ~]# docker container run -itd nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
0a4690c5d889: Pull complete
9719afee3eb7: Pull complete
44446b456159: Pull complete
Digest: sha256:b4b9b3eee194703fc2fa8afa5b7510c77ae70cfba567af1376a573a967c03dbb
Status: Downloaded newer image for nginx:latest
d6110871fab5dbd0503bdde818e597e40860f7397ed868f1d7da72afe3edbefd
[root@ip-172-31-40-217 ~]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d6110871fab5 nginx "nginx -g 'daemon of…" 23 seconds ago Up 22 seconds 80/tcp suspicious_hamilton
[root@ip-172-31-40-217 ~]# docker network inspect bridge
"Containers": {
"d6110871fab5dbd0503bdde818e597e40860f7397ed868f1d7da72afe3edbefd": {
"Name": "suspicious_hamilton",
"EndpointID": "af174e6c181f987c4c24318b911eb067b7f2442f9ea151179041c46038ab179f",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
Now one container attached with bridge network
[root@ip-172-31-40-217 ~]# docker container run -it ubuntu:14.04 bash
root@12848ca91085:/#
root@12848ca91085:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=1.62 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=47 time=1.64 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=47 time=1.63 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=47 time=1.63 ms
This means that this container has internet access.
No comments:
Post a Comment