您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)Docker網(wǎng)絡(luò)怎么實現(xiàn)雙向連接,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
docker network ls [root@master ~]# docker network lsNETWORK ID NAME DRIVER SCOPE e9ecd3b9be87 bridge bridge local45336895a3a4 host host local6a44e8330adb none null local
docker network create bridge my-bridge [root@master ~]# docker network create -d bridge my-bridge0ae59991f86c3276acfc5a78dd316f47c124f093e60ce719046f1045ccccb1bd [root@master ~]# docker network lsNETWORK ID NAME DRIVER SCOPE e9ecd3b9be87 bridge bridge local45336895a3a4 host host local0ae59991f86c my-bridge bridge local6a44e8330adb none null local
docker network connect my-bridge centos-test-1 docker network connect my-bridge centos-test-2 [root@master ~]# docker network connect my-bridge centos-test-1[root@master ~]# docker network connect my-bridge centos-test-2
[root@master ~]# docker exec -it centos-test-1 bash[root@bd4aa8b35c8d /]# ping centos-test-2PING centos-test-2 (172.18.0.3) 56(84) bytes of data. 64 bytes from centos-test-2.my-bridge (172.18.0.3): icmp_seq=1 ttl=64 time=0.131 ms 64 bytes from centos-test-2.my-bridge (172.18.0.3): icmp_seq=2 ttl=64 time=0.163 ms ^C --- centos-test-2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.131/0.147/0.163/0.016 ms [root@master ~]# docker exec -it centos-test-2 bash[root@d8eac6105db2 /]# ping centos-test-1PING centos-test-1 (172.18.0.2) 56(84) bytes of data. 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=1 ttl=64 time=0.187 ms 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=2 ttl=64 time=0.405 ms 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=3 ttl=64 time=0.150 ms ^C --- centos-test-1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 4ms rtt min/avg/max/mdev = 0.150/0.247/0.405/0.113 ms [root@master ~]# docker exec -it centos-test-2 bash[root@d8eac6105db2 /]# ping centos-test-1PING centos-test-1 (172.18.0.2) 56(84) bytes of data. 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=1 ttl=64 time=0.187 ms 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=2 ttl=64 time=0.405 ms 64 bytes from centos-test-1.my-bridge (172.18.0.2): icmp_seq=3 ttl=64 time=0.150 ms ^C --- centos-test-1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 4ms rtt min/avg/max/mdev = 0.150/0.247/0.405/0.113 ms
關(guān)于“Docker網(wǎng)絡(luò)怎么實現(xiàn)雙向連接”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。