02_同步镜像到私有仓库(Rancher-高可用集群HA部署-离线安装)

1.同步镜像到私有镜像仓库

同步镜像前,为保证镜像能正确同步到私有仓储中,需先创建好项目。

1.1 登录Harbor仓库手工创建项目名(公开)如下:

rancher
quay.io

1.2 同步镜像

harbor已经配置好https访问
官网同步命令:根据镜像仓库使用80,443决定用哪条命令:
使用443端口

./rancher-load-images.sh --image-list ./rancher-images.txt --registry harbor.techzsun.com

官方文档有写端口,但在配置好https后,443即为默认,不需在命令中再添加端口,否则,镜像打tag时带了port。

harbor仓库磁盘空间(初始只有一个redis:6.0.5)

[root@harbor ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 2.0G     0  2.0G   0% /dev
tmpfs                    2.0G     0  2.0G   0% /dev/shm
tmpfs                    2.0G  9.2M  2.0G   1% /run
tmpfs                    2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/mapper/centos-root  299G  4.4G  295G   2% /
/dev/sda1               1014M  293M  722M  29% /boot
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/9c9ed548ddf5770c1be264465bba2e9decd1ac1994c2b1d4fdeb8b537138706b/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/6a717233d88732ee5a691bd2f5fa9422cbd548c1bad8b50a63e462b92a5c5a36/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/b8d042084ebb657948fb656d9817510bce03dbf59fd334e6504ba5f03e718777/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/01f56f79a31772da426e686545b20e72c5faf1d3cb85e1a4619d97816cacccf2/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/aa7dd9a41f00c65288b863363d10b1fa2bd6b60643979b85af2cd621e8f71695/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/45d2cd95b48f997c2b8b82b756c32cf0866af5b6f3b5355fc11b6e3fc4c3305e/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/3b7391958824afe424d3f05123a16b46b85525ac3f3a9447a93a28c74763695a/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/d1a6aa914eef90d7c95cae9bd503741e53ab50e97d1617226d5a883441eaa471/merged
overlay                  299G  4.4G  295G   2% /var/lib/docker/overlay2/574807a5fbc78f7c7bbccf2fceeb116ed01b745126dbefd46578926226fbd5b4/merged
tmpfs                    394M     0  394M   0% /run/user/0

原仓库镜像:

[root@harbor ~]# docker images
REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE
goharbor/chartmuseum-photon          v2.1.2              957cad6ee4f4        2 months ago        172MB
goharbor/redis-photon                v2.1.2              ab361cc80013        2 months ago        68.8MB
goharbor/trivy-adapter-photon        v2.1.2              396c0a289a68        2 months ago        106MB
goharbor/clair-adapter-photon        v2.1.2              b43551e703c2        2 months ago        58MB
goharbor/clair-photon                v2.1.2              0e9f86b78780        2 months ago        168MB
goharbor/notary-server-photon        v2.1.2              ca212469d8d7        2 months ago        104MB
goharbor/notary-signer-photon        v2.1.2              cf87adab9022        2 months ago        101MB
goharbor/harbor-registryctl          v2.1.2              da26ae6a8d51        2 months ago        132MB
goharbor/registry-photon             v2.1.2              417d60a20a94        2 months ago        80.1MB
goharbor/nginx-photon                v2.1.2              f9ea32db995f        2 months ago        40.1MB
goharbor/harbor-log                  v2.1.2              7514c453345e        2 months ago        106MB
goharbor/harbor-jobservice           v2.1.2              123382c0d590        2 months ago        169MB
goharbor/harbor-core                 v2.1.2              46211d9a0f44        2 months ago        150MB
goharbor/harbor-portal               v2.1.2              6eedd3daad4c        2 months ago        49.5MB
goharbor/harbor-db                   v2.1.2              f0c14faef5d5        2 months ago        172MB
goharbor/prepare                     v2.1.2              cc5f5219b08b        2 months ago        161MB
redis                                6.0.5               235592615444        8 months ago        104MB
harbor.techzsun.com/easytong/redis   6.0.5               235592615444        8 months ago        104MB

原有容器:

[root@harbor ~]# docker-compose -f /opt/harbor/docker-compose.yml  ps
      Name                     Command                  State                          Ports                   
---------------------------------------------------------------------------------------------------------------
harbor-core         /harbor/entrypoint.sh            Up (healthy)                                              
harbor-db           /docker-entrypoint.sh            Up (healthy)                                              
harbor-jobservice   /harbor/entrypoint.sh            Up (healthy)                                              
harbor-log          /bin/sh -c /usr/local/bin/ ...   Up (healthy)   127.0.0.1:1514->10514/tcp                  
harbor-portal       nginx -g daemon off;             Up (healthy)                                              
nginx               nginx -g daemon off;             Up (healthy)   0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp
redis               redis-server /etc/redis.conf     Up (healthy)                                              
registry            /home/harbor/entrypoint.sh       Up (healthy)                                              
registryctl         /home/harbor/start.sh            Up (healthy)