标签:ice 运维 obs hit fixed world docker0 方案 维护
Harbor以“项目”为中心,通过对项目配置“复制策略”,标明需要复制的项目以及镜像。管理员在复制策略中指明目标实例,即复制的“目的地”,并对它的地址和连接时使用的用户名密码进行设置。当复制策略被激活时,源项目下的所有镜像,都会被复制到目标实例;此外,当源项目下的镜像被添加或删除(push或delete), 只要策略还在激活状态,镜像的变化都会同步到目标实例上去, 如下图所示:
1 172.24.8.111 reg.harbor01.com 2 172.24.8.112 reg.harbor02.com
1 root@docker02:~/harbor# cat addhosts.sh 2 #!/bin/sh 3 #****************************************************************# 4 # ScriptName: test.sh 5 # Author: xhy@itzgr.com 6 # Create Date: 2018-10-27 15:48 7 # Modify Author: xhy@itzgr.com 8 #***************************************************************# 9 docker ps | awk ‘{print $1}‘>./dockerlist.txt 10 for id in `cat ./dockerlist.txt` 11 do 12 HOSTS=`docker inspect $id | grep hosts | awk -F "\"" ‘{print $4}‘` 13 echo -e "172.24.8.111 reg.harbor01.com\n172.24.8.112 reg.harbor02.com" >> $HOSTS 14 done
1 root@docker03:~# vi /etc/hosts 2 172.24.8.111 reg.harbor01.com 3 172.24.8.112 reg.harbor02.com 4 root@docker03:~# vi /etc/docker/daemon.json 5 { 6 "insecure-registries": ["http://reg.harbor01.com","http://reg.harbor02.com"] 7 } 8 root@docker03:~# systemctl daemon-reload 9 root@docker03:~# systemctl restart docker.service 10 root@docker03:~# docker login reg.harbor01.com #登录registry 11 Username: admin 12 Password:
1 root@docker03:~# docker pull hello-world 2 root@docker03:~# docker tag hello-world:latest reg.harbor01.com/copyregistry/hello-world:xhy 3 root@docker03:~# docker push reg.harbor01.com/copyregistry/hello-world:xhy
标签:ice 运维 obs hit fixed world docker0 方案 维护
原文地址:https://www.cnblogs.com/itzgr/p/10177143.html