Docker Network

cuong@techmaster.vn

docker network ls liệt kê các network

docker network create tạo một network mới

docker network rm xoá một network

docker network disconnect ngắt kết nối vào network
docker network inspect khảo sát một kết nối

docker network thay thế cho lệnh link đã cũ

docker network ls
docker network ls                                                                                         
NETWORK ID          NAME                DRIVER              SCOPE
09b068f8d30a        bridge              bridge              local
c6c66c513b76        host                host                local
924b7875818c        none                null                local
docker network create
docker network create -d bridge private_net
docker network connect
docker network connect private_net containerA

một container có thể nối vào nhiều network

containerA: ping containerB // OK
containerA: ping containerC // Failed

containerB: ping containerA // Ok
containerB: ping containerC // Ok

containerC: ping containerA // Failed
docker network create -d bridge netY
docker network create -d bridge netX
docker network create -d bridge netZ

docker run --name=boxA -it --net=netX alpine /bin/sh
docker network connect netZ boxA

docker run --name=boxB -it --net=netX alpine /bin/sh
docker network connect netY boxB

docker run --name=boxC -it --net=netZ alpine /bin/sh
docker network connect netZ boxC

docker run --name=boxD -it --net=netX alpine:latest /bin/sh
docker network connect netZ boxD
docker network connect netY boxD
Made with Slides.com