20201006 映像與倉庫 (三)
課堂資料
如何備份 Docker Image 為 tar 檔:
Docker Harbor 安裝:
Docker容器倉庫Harbor的安裝部署:
Harbor
Harbor 的安裝部署
systemctl status sshd
docker save -o myhttpd.tar [鏡像ID]

scp myhttpd.tar user@192.168.8.130:/home/user
ls
mv harbor1.9.0.tgz /root
ls
cd

安裝和配置
tar xvf harbor1.9.0.tgz
cd harbor
ls
gedit harbor.yml &

hostname 改為192.168.8.129
harbor_adnim_password 改為 hb12345

執行安裝程序
sh install.sh


Docker Bridge Network
Bridge Network 架構

課堂練習
Harbor 操作
Docker Bridge Network
檢視目前 Docker Network 狀態
docker network ls
建立 container
第一種網路用法 ( none ):不要啟動任何網路
docker run -it --network=none busybox:latest sh
ifconfig
exit

第二種網路用法 ( host ):防攻擊、偵測
docker run -it --network=host busybox:latest sh
ifconfig
exit

第三種網路用法 [( bridge )預設網路類型 ]:docker0
docker run -it --network=bridge --name a1 busybox:latest sh
ifconfig
ping 172.17.0.1
exit

docker run -it --network=bridge --name a2 busybox:latest sh
ifconfig
exit
docker run -it --network=bridge --name a3 busybox:latest sh
ifconfig
exit
docker inspect a1

查看bridge
brctl show
自訂 docker network
docker network create --driver bridge mynet
docker network ls
建立 container
docker run -it --name a4 --network mynet busybox sh
ifconfig
exit
docker network connect bridge a4
docker network disconnect bridge a4

測試 container 網路
docker run -it --name a5 --network mynet busybox sh
docker exec -it a5 sh

Last updated
Was this helpful?