0
点赞
收藏
分享

微信扫一扫

G032-CON-CKA-DOC-03 CentOS Stream 9 搭建企业级 Registry 服务器 Harbor v2.7.0

1 您需要了解

  • 虚拟化平台版本 VMware Workstation 17.0.1 ,本篇使用镜像版本为 CentOS-Stream-9-20230131.0-x86_64-dvd1.iso,最小化 minimal 安装
  • 安装源镜像您可访问 CentOS官网 / 阿里开源镜像站 或其他镜像站进行下载
  • 截至发稿前,Docker 最新版本为 23.0.1,Harbor 最新版本为 v2.7.0,点击这里 GitHub 下载 Harbor,如访问受限,您可通过站内私信进行获取
  • 为有更好的浏览体验,您可以点击文章左上方目录按钮来显示文章整体目录结构
  • 相关文章
  • G003-OS-LIN-RHEL-01 红帽 8.4 安装

2 系统设置

2.1 关闭防火墙及SELinux

[root@cloudcs ~]# systemctl stop firewalld
[root@cloudcs ~]# systemctl disable firewalld
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@cloudcs ~]# setenforce 0
[root@cloudcs ~]# sed -i 's/^SELINUX=enforcing$/SELINUX=disabled/' /etc/selinux/config

2.2 安装 Docker

  • 装包
[root@cloudcs ~]# yum install -y vim net-tools bash-completion yum-utils
[root@cloudcs ~]# bash
  • 添加 docker-ce 源
[root@cloudcs ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@cloudcs ~]# ls /etc/yum.repos.d/
centos-addons.repo  centos.repo  docker-ce.repo
  • 查看 docker-ce 版本
[root@cloudcs ~]# yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64                3:23.0.1-1.el9                  docker-ce-stable
docker-ce.x86_64                3:23.0.0-1.el9                  docker-ce-stable
docker-ce.x86_64                3:20.10.23-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.22-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.21-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.20-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.19-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.18-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.17-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.16-3.el9                docker-ce-stable
docker-ce.x86_64                3:20.10.15-3.el9                docker-ce-stable
Docker CE Stable - x86_64                        44 kB/s |  18 kB     00:00    
Available Packages
  • 安装最新版
#不指定版本,默认为当前最新版本
[root@cloudcs ~]# yum install -y docker-ce
Last metadata expiration check: 0:01:29 ago on Sat 11 Feb 2023 09:51:11 PM CST.
Dependencies resolved.
==================================================================================================================================================
 Package                                       Architecture            Version                            Repository                         Size
==================================================================================================================================================
Installing:
 docker-ce                                     x86_64                  3:23.0.1-1.el9                     docker-ce-stable                   23 M
Installing dependencies:
 checkpolicy                                   x86_64                  3.5-0.rc2.1.el9                    appstream                         347 k
 container-selinux                             noarch                  3:2.199.0-1.el9                    appstream                          51 k
 containerd.io                                 x86_64                  1.6.16-3.1.el9                     docker-ce-stable                   32 M
 docker-ce-cli                                 x86_64                  1:23.0.1-1.el9                     docker-ce-stable                  7.0 M
 docker-ce-rootless-extras                     x86_64                  23.0.1-1.el9                       docker-ce-stable                  3.8 M
 fuse-overlayfs                                x86_64                  1.10-1.el9                         appstream                          72 k
 fuse3                                         x86_64                  3.10.2-5.el9                       appstream                          54 k
 fuse3-libs                                    x86_64                  3.10.2-5.el9                       appstream                          93 k
 libslirp                                      x86_64                  4.4.0-4.el9                        appstream                          69 k
 policycoreutils-python-utils                  noarch                  3.5-0.rc1.2.el9                    appstream                          75 k
 python3-audit                                 x86_64                  3.0.7-103.el9                      appstream                          84 k
 python3-distro                                noarch                  1.5.0-7.el9                        baseos                             37 k
 python3-libsemanage                           x86_64                  3.5-0.rc1.1.el9                    appstream                          80 k
 python3-policycoreutils                       noarch                  3.5-0.rc1.2.el9                    appstream                         2.1 M
 python3-setools                               x86_64                  4.4.0-5.el9                        baseos                            599 k
 python3-setuptools                            noarch                  53.0.0-12.el9                      baseos                            944 k
 slirp4netns                                   x86_64                  1.2.0-2.el9                        appstream                          47 k
Installing weak dependencies:
 docker-buildx-plugin                          x86_64                  0.10.2-1.el9                       docker-ce-stable                   12 M
 docker-compose-plugin                         x86_64                  2.16.0-1.el9                       docker-ce-stable                   11 M
 docker-scan-plugin                            x86_64                  0.23.0-3.el9                       docker-ce-stable                  3.8 M

...省略...

Installed:
  checkpolicy-3.5-0.rc2.1.el9.x86_64                                   container-selinux-3:2.199.0-1.el9.noarch                                  
  containerd.io-1.6.16-3.1.el9.x86_64                                  docker-buildx-plugin-0.10.2-1.el9.x86_64                                  
  docker-ce-3:23.0.1-1.el9.x86_64                                      docker-ce-cli-1:23.0.1-1.el9.x86_64                                       
  docker-ce-rootless-extras-23.0.1-1.el9.x86_64                        docker-compose-plugin-2.16.0-1.el9.x86_64                                 
  docker-scan-plugin-0.23.0-3.el9.x86_64                               fuse-overlayfs-1.10-1.el9.x86_64                                          
  fuse3-3.10.2-5.el9.x86_64                                            fuse3-libs-3.10.2-5.el9.x86_64                                            
  libslirp-4.4.0-4.el9.x86_64                                          policycoreutils-python-utils-3.5-0.rc1.2.el9.noarch                       
  python3-audit-3.0.7-103.el9.x86_64                                   python3-distro-1.5.0-7.el9.noarch                                         
  python3-libsemanage-3.5-0.rc1.1.el9.x86_64                           python3-policycoreutils-3.5-0.rc1.2.el9.noarch                            
  python3-setools-4.4.0-5.el9.x86_64                                   python3-setuptools-53.0.0-12.el9.noarch                                   
  slirp4netns-1.2.0-2.el9.x86_64                                      

Complete!

#启动服务
[root@cloudcs ~]# systemctl start docker
[root@cloudcs ~]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@cloudcs ~]# docker -v
Docker version 23.0.1, build a5ee5b1

#如果安装指定版本,可带上版本号,例如:
[root@cloudcs ~]# yum install -y docker-ce-20.10.23 docker-ce-cli-20.10.23

3 Harbor 安装

3.1 传包并解压

[root@cloudcs ~]# ls
anaconda-ks.cfg  harbor-offline-installer-v2.7.0.tgz
[root@cloudcs ~]# tar -zxvf harbor-offline-installer-v2.7.0.tgz 
harbor/harbor.v2.7.0.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl

3.2 配置 Harbor

  • 修改 harbor.yml
[root@cloudcs ~]# ls
anaconda-ks.cfg  harbor  harbor-offline-installer-v2.7.0.tgz
[root@cloudcs ~]# cd harbor/
[root@cloudcs harbor]# ls
common.sh  harbor.v2.7.0.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@cloudcs harbor]# cp harbor.yml.tmpl harbor.yml
[root@cloudcs harbor]# vim harbor.yml

#修改主机名为本机IP地址
hostname: 192.168.146.137

#修改端口号为5000,可自定义
# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 5000

#注释 https
# https related config
# https:
  # https port for harbor, default is 443
  # port: 443
  # The path of cert and key files for nginx
  # certificate: /your/certificate/path
  # private_key: /your/private/key/path

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.

#修改管理员密码
harbor_admin_password: cloudcs123456
  • 修改 docker.service
[root@cloudcs harbor]# vim /usr/lib/systemd/system/docker.service

#在 ExecStart 参数后面添加 --insecure-registry=192.168.146.137:5000
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --insecure-registry=192.168.146.137:5000

#配置加速器(可选)
[root@cloudcs harbor]# vim /etc/docker/daemon.json
[root@cloudcs harbor]# cat /etc/docker/daemon.json 
{
  "registry-mirrors": ["https://cc2d8woc.mirror.aliyuncs.com"]
}

#重启服务
[root@cloudcs harbor]# systemctl daemon-reload 
[root@cloudcs harbor]# systemctl restart docker
  • 运行 prepare 脚本准备镜像
[root@cloudcs harbor]# ls
common.sh  harbor.v2.7.0.tar.gz  harbor.yml  harbor.yml.tmpl  install.sh  LICENSE  prepare
[root@cloudcs harbor]# ./prepare 
prepare base dir is set to /root/harbor
Unable to find image 'goharbor/prepare:v2.7.0' locally
v2.7.0: Pulling from goharbor/prepare
1871d44f4cdb: Pull complete 
9e5f23534b75: Pull complete 
b234075cadb4: Pull complete 
2ee6e5a578c1: Pull complete 
0b0e76074063: Pull complete 
c4c9b2e450d6: Pull complete 
c70804059354: Pull complete 
721611d803a1: Pull complete 
d53c5290e042: Pull complete 
0d8cc28f3d0c: Pull complete 
Digest: sha256:47df4e214c8fd9ea0352a903dba884a480fa18f39ef426f7b890cf822f848139
Status: Downloaded newer image for goharbor/prepare:v2.7.0
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
  • 修改脚本命令

CentOS 8 / CentOS 9 版本中使用的 docker compose 命令与 CentOS 7 版本命令不同,脚本中默认使用的是 CentOS 7 版本命令 docker-compose,该命令当前操作系统不支持。

#例如
[root@cloudcs ~]# docker-compose
bash: docker-compose: command not found

[root@cloudcs ~]# docker compose
Usage:  docker compose [OPTIONS] COMMAND
Docker Compose

#修改 common.sh
[root@cloudcs harbor]# vim common.sh
#原 119 行 elif [[ $(docker-compose --version) =~ (([0-9]+)\.([0-9]+)([\.0-9]*)) ]]
#修改为 elif [[ $(docker compose version) =~ (([0-9]+)\.([0-9]+)([\.0-9]*)) ]]

#修改 install.sh
[root@cloudcs harbor]# vim install.sh
#原 26 行 DOCKER_COMPOSE=docker-compose
#修改为 DOCKER_COMPOSE="docker compose"

3.3 安装 Harbor

[root@cloudcs harbor]# ./install.sh 

#完整日志流记录
[Step 0]: checking if docker is installed ...

Note: docker version: 23.0.1

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.16.0

[Step 2]: loading Harbor images ...
Loaded image: goharbor/prepare:v2.7.0
716575e41c45: Loading layer [==================================================>]  145.8MB/145.8MB
af0525d96b0b: Loading layer [==================================================>]  16.72MB/16.72MB
939977d7cbf6: Loading layer [==================================================>]   5.12kB/5.12kB
005530be0f99: Loading layer [==================================================>]  6.144kB/6.144kB
9764bccefdd0: Loading layer [==================================================>]  3.072kB/3.072kB
38fe09b6e0e7: Loading layer [==================================================>]  2.048kB/2.048kB
9d659849215a: Loading layer [==================================================>]   2.56kB/2.56kB
bee3f2947ec7: Loading layer [==================================================>]   2.56kB/2.56kB
e4e05d8658d3: Loading layer [==================================================>]   2.56kB/2.56kB
e7991cc39265: Loading layer [==================================================>]  9.728kB/9.728kB
Loaded image: goharbor/harbor-db:v2.7.0
d79110caaa26: Loading layer [==================================================>]  8.902MB/8.902MB
b8cddfca4e88: Loading layer [==================================================>]  3.584kB/3.584kB
071b47da1d9b: Loading layer [==================================================>]   2.56kB/2.56kB
d22932d9f6c7: Loading layer [==================================================>]  84.83MB/84.83MB
b2f2e9cbceac: Loading layer [==================================================>]  5.632kB/5.632kB
53cce0f5bd54: Loading layer [==================================================>]    108kB/108kB
40a6c61dcc44: Loading layer [==================================================>]  44.03kB/44.03kB
6d7dba633513: Loading layer [==================================================>]  85.77MB/85.77MB
44309ebcfcf7: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.7.0
cebcabcec86e: Loading layer [==================================================>]    127MB/127MB
f3a76df94b70: Loading layer [==================================================>]  3.584kB/3.584kB
ac9852cda3ce: Loading layer [==================================================>]  3.072kB/3.072kB
a5bab3cf8af7: Loading layer [==================================================>]   2.56kB/2.56kB
d52202b6a929: Loading layer [==================================================>]  3.072kB/3.072kB
bd8a7ca8438d: Loading layer [==================================================>]  3.584kB/3.584kB
a6a054173348: Loading layer [==================================================>]  20.99kB/20.99kB
Loaded image: goharbor/harbor-log:v2.7.0
1a3b490c3dc4: Loading layer [==================================================>]  8.902MB/8.902MB
7cbd50b78394: Loading layer [==================================================>]  25.65MB/25.65MB
7119ae84be31: Loading layer [==================================================>]  4.608kB/4.608kB
c9c5875f25c8: Loading layer [==================================================>]  26.44MB/26.44MB
Loaded image: goharbor/harbor-exporter:v2.7.0
c8c89cfdc06a: Loading layer [==================================================>]  119.1MB/119.1MB
Loaded image: goharbor/nginx-photon:v2.7.0
59736e375413: Loading layer [==================================================>]  5.759MB/5.759MB
6cc787909b61: Loading layer [==================================================>]  91.75MB/91.75MB
a56e97e08300: Loading layer [==================================================>]  3.072kB/3.072kB
57925eac82a6: Loading layer [==================================================>]  4.096kB/4.096kB
6e36a605c736: Loading layer [==================================================>]  92.54MB/92.54MB
Loaded image: goharbor/chartmuseum-photon:v2.7.0
175f4dc2d45f: Loading layer [==================================================>]  119.1MB/119.1MB
4e26408b204b: Loading layer [==================================================>]  6.143MB/6.143MB
f2e93a87e40b: Loading layer [==================================================>]  1.249MB/1.249MB
e5cceb0b0435: Loading layer [==================================================>]  1.194MB/1.194MB
Loaded image: goharbor/harbor-portal:v2.7.0
b887c32c40a7: Loading layer [==================================================>]  8.902MB/8.902MB
938a7e3c75f5: Loading layer [==================================================>]  3.584kB/3.584kB
5a5a28182655: Loading layer [==================================================>]   2.56kB/2.56kB
ebab1e49abda: Loading layer [==================================================>]  103.3MB/103.3MB
4ce14e0439d9: Loading layer [==================================================>]    104MB/104MB
Loaded image: goharbor/harbor-jobservice:v2.7.0
fbaa7a10893c: Loading layer [==================================================>]  5.759MB/5.759MB
c688ac7b41fa: Loading layer [==================================================>]  4.096kB/4.096kB
d7c1e408fc7d: Loading layer [==================================================>]  17.41MB/17.41MB
55958792b639: Loading layer [==================================================>]  3.072kB/3.072kB
a914e1c2d3e7: Loading layer [==================================================>]  30.69MB/30.69MB
b91233145a72: Loading layer [==================================================>]  48.89MB/48.89MB
Loaded image: goharbor/harbor-registryctl:v2.7.0
4bfd949c2891: Loading layer [==================================================>]  5.759MB/5.759MB
7fd746eb54cc: Loading layer [==================================================>]  4.096kB/4.096kB
026a4a79ef61: Loading layer [==================================================>]  3.072kB/3.072kB
4e8dca75f609: Loading layer [==================================================>]  17.41MB/17.41MB
7e017925a772: Loading layer [==================================================>]   18.2MB/18.2MB
Loaded image: goharbor/registry-photon:v2.7.0
bd6904b66a79: Loading layer [==================================================>]  5.754MB/5.754MB
4bea14657109: Loading layer [==================================================>]  8.987MB/8.987MB
629d40c48f45: Loading layer [==================================================>]  15.88MB/15.88MB
48d73b35455c: Loading layer [==================================================>]  29.29MB/29.29MB
fe12338e806d: Loading layer [==================================================>]  22.02kB/22.02kB
dcbe4fc18411: Loading layer [==================================================>]  15.88MB/15.88MB
Loaded image: goharbor/notary-server-photon:v2.7.0
cc039d70dda6: Loading layer [==================================================>]  119.9MB/119.9MB
c128fc8dd5aa: Loading layer [==================================================>]  3.072kB/3.072kB
e030017184f0: Loading layer [==================================================>]   59.9kB/59.9kB
f7a67f51f6d5: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.7.0
c4c80dff091a: Loading layer [==================================================>]  5.754MB/5.754MB
26f51848acfb: Loading layer [==================================================>]  8.987MB/8.987MB
fb0e59f893b6: Loading layer [==================================================>]  14.47MB/14.47MB
e17fcd490db6: Loading layer [==================================================>]  29.29MB/29.29MB
f0f3d13b4bdf: Loading layer [==================================================>]  22.02kB/22.02kB
73965e1762cb: Loading layer [==================================================>]  14.47MB/14.47MB
Loaded image: goharbor/notary-signer-photon:v2.7.0
2d831b255ec9: Loading layer [==================================================>]  6.287MB/6.287MB
603534b77185: Loading layer [==================================================>]  4.096kB/4.096kB
edbbda0ede29: Loading layer [==================================================>]  3.072kB/3.072kB
11ccb87ea0a3: Loading layer [==================================================>]  180.6MB/180.6MB
13afce1af948: Loading layer [==================================================>]  13.22MB/13.22MB
b05259901192: Loading layer [==================================================>]  194.6MB/194.6MB
Loaded image: goharbor/trivy-adapter-photon:v2.7.0


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Clearing the configuration file: /config/portal/nginx.conf
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/passwd
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
loaded secret from file: /data/secret/keys/secretkey
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...


[Step 5]: starting Harbor ...
[+] Running 10/10
 ⠿ Network harbor_harbor        Created                                                                                                                                    0.0s
 ⠿ Container harbor-log         Started                                                                                                                                    0.8s
 ⠿ Container harbor-db          Started                                                                                                                                    1.8s
 ⠿ Container registryctl        Started                                                                                                                                    1.6s
 ⠿ Container registry           Started                                                                                                                                    1.7s
 ⠿ Container harbor-portal      Started                                                                                                                                    1.7s
 ⠿ Container redis              Started                                                                                                                                    1.8s
 ⠿ Container harbor-core        Started                                                                                                                                    2.3s
 ⠿ Container harbor-jobservice  Started                                                                                                                                    2.7s
 ⠿ Container nginx              Started                                                                                                                                    2.7s
✔ ----Harbor has been installed and started successfully.----

3.4 登录 Harbor

默认管理员账号 admin,密码为 3.2 小节 配置文件中的自定义密码

image.png

4 测试

4.1 创建项目

访问级别设置为 公开,可以进行匿名拉取,存储容量默认 -1 表示大小没有限制

image.png

4.2 推送镜像

进入项目后,在右上角推送命令中可查看操作语句,注意推送镜像之前需要身份认证

image.png

#标记镜像
[root@cloudcs harbor]# docker images |grep mysql
mysql                           latest    3218b38490ce   13 months ago   516MB

[root@cloudcs harbor]# docker tag mysql:latest 192.168.146.137:5000/cloudcs/mysql:latest

[root@cloudcs harbor]# docker images |grep mysql
192.168.146.137:5000/cloudcs/mysql   latest    3218b38490ce   13 months ago   516MB
mysql                                latest    3218b38490ce   13 months ago   516MB

#登录镜像仓库(身份认证)
[root@cloudcs harbor]# docker login 192.168.146.137:5000
Username: admin
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

#推送镜像
[root@cloudcs harbor]# docker push 192.168.146.137:5000/cloudcs/mysql:latest 
The push refers to repository [192.168.146.137:5000/cloudcs/mysql]
d67a9f3f6569: Pushed 
fc8a043a3c75: Pushed 
118fee5d988a: Pushed 
c654c2afcbba: Pushed 
1d1f48e448f9: Pushed 
aad27784b762: Pushed 
0d17fee8db40: Pushed 
d7a777f6c3a4: Pushed 
a0c2a050fee2: Pushed 
0798f2528e83: Pushed 
fba7b131c5c3: Pushed 
ad6b69b54919: Pushed 
latest: digest: sha256:238cf050a7270dd6940602e70f1e5a11eeaf4e02035f445b7f613ff5e0641f7d size: 2828

image.png

4.3 拉取镜像

#删除mysql镜像
[root@cloudcs harbor]# docker rmi $(docker images |grep mysql |awk '{print $1}')
Untagged: 192.168.146.137:5000/cloudcs/mysql:latest
Untagged: 192.168.146.137:5000/cloudcs/mysql@sha256:238cf050a7270dd6940602e70f1e5a11eeaf4e02035f445b7f613ff5e0641f7d
Untagged: mysql:latest
Untagged: mysql@sha256:e9027fe4d91c0153429607251656806cc784e914937271037f7738bd5b8e7709
Deleted: sha256:3218b38490cec8d31976a40b92e09d61377359eab878db49f025e5d464367f3b
Deleted: sha256:aa81ca46575069829fe1b3c654d9e8feb43b4373932159fe2cad1ac13524a2f5
Deleted: sha256:0558823b9fbe967ea6d7174999be3cc9250b3423036370dc1a6888168cbd224d
Deleted: sha256:a46013db1d31231a0e1bac7eeda5ad4786dea0b1773927b45f92ea352a6d7ff9
Deleted: sha256:af161a47bb22852e9e3caf39f1dcd590b64bb8fae54315f9c2e7dc35b025e4e3
Deleted: sha256:feff1495e6982a7e91edc59b96ea74fd80e03674d92c7ec8a502b417268822ff
Deleted: sha256:8805862fcb6ef9deb32d4218e9e6377f35fb351a8be7abafdf1da358b2b287ba
Deleted: sha256:872d2f24c4c64a6795e86958fde075a273c35c82815f0a5025cce41edfef50c7
Deleted: sha256:6fdb3143b79e1be7181d32748dd9d4a845056dfe16ee4c827410e0edef5ad3da
Deleted: sha256:b0527c827c82a8f8f37f706fcb86c420819bb7d707a8de7b664b9ca491c96838
Deleted: sha256:75147f61f29796d6528486d8b1f9fb5d122709ea35620f8ffcea0e0ad2ab0cd0
Deleted: sha256:2938c71ddf01643685879bf182b626f0a53b1356138ef73c40496182e84548aa
Deleted: sha256:ad6b69b549193f81b039a1d478bc896f6e460c77c1849a4374ab95f9a3d2cea2

#拉取mysql镜像
[root@cloudcs harbor]# docker pull 192.168.146.137:5000/cloudcs/mysql:latest
latest: Pulling from cloudcs/mysql
72a69066d2fe: Pull complete 
93619dbc5b36: Pull complete 
99da31dd6142: Pull complete 
626033c43d70: Pull complete 
37d5d7efb64e: Pull complete 
ac563158d721: Pull complete 
d2ba16033dad: Pull complete 
688ba7d5c01a: Pull complete 
00e060b6d11d: Pull complete 
1c04857f594f: Pull complete 
4d7cfa90e6ea: Pull complete 
e0431212d27d: Pull complete 
Digest: sha256:238cf050a7270dd6940602e70f1e5a11eeaf4e02035f445b7f613ff5e0641f7d
Status: Downloaded newer image for 192.168.146.137:5000/cloudcs/mysql:latest
192.168.146.137:5000/cloudcs/mysql:latest

[root@cloudcs harbor]# docker images |grep mysql
192.168.146.137:5000/cloudcs/mysql   latest    3218b38490ce   13 months ago   516MB
  • END
举报

相关推荐

0 条评论