linux centos 升级docker并安装harbor及简单的使用

1、Linux下安装docker容器

1、由于harbor不支持低版本的docker ,故先检查本地docker的版本

[root@host20 ~]# docker --version
Docker version 1.13.1, build 7d71120/1.13.1
[root@host20 ~]# 

2、 查看docker安装的软件

[root@192 harbor]#  rpm -qa | grep docker 
docker-common-1.13.1-208.git7d71120.el7_9.x86_64  
docker-client-1.13.1-208.git7d71120.el7_9.x86_64 
docker-1.13.1-208.git7d71120.el7_9.x86_64
[root@192 harbor]# 

3、若版本过旧则删除版本

[root@192 harbor]#  yum remove docker-common-1.13.1-208.git7d71120.el7_9.x86_64 \
 docker-client-1.13.1-208.git7d71120.el7_9.x86_64 \
 docker-1.13.1-208.git7d71120.el7_9.x86_64

4、安装最新docker

 [root@192 harbor]#  curl -fsSL https://get.docker.com/ | sh

2、安装harbor

1. 下载harbor离线安装包

wget https://github-releases.githubusercontent.com/50613991/327f5e63-ba30-4dfe-82fa-714f16d39148?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210904%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210904T165526Z&X-Amz-Expires=300&X-Amz-Signature=0ae56b33a617f24a7d3fecea31aca632923453b7a76d7aee4e8bf7c92a8a268e&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=50613991&response-content-disposition=attachment%3B%20filename%3Dharbor-offline-installer-v2.3.2.tgz

2. 解压安装包

[root@192 harbor]#  tar -xvf harbor-offline-installer-v2.3.2.tgz
[root@192 harbor]#  cd harbor/
[root@192 harbor]#  ls
common.sh  harbor.v2.3.2.tar.gz  harbor.yml.tmpl  install.sh  LICENSE  prepare

解压后会生成以上文件,将harbor.yml.tmpl 拷贝一份作为配置为念yml

[root@192 harbor]# vi harbor.yml
# Configuration file of Harbor

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.222.21

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

# https related config
https: #将https 内容全部注释掉,否则就需要配置安全密钥,可以用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: Harbor12345#默认登录密码,可自定义

# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: root123#默认数据密码,可自定义
  # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
  max_idle_conns: 100
  # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
  # Note: the default number of connections is 1024 for postgres of harbor.
  max_open_conns: 900

"harbor.yml" 201L, 7848C written

3.执行准备命令

[root@192 harbor]# ./prepare
prepare base dir is set to /data/soft/harbor/harbor
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

4、执行安装命令

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

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.8

[Step 1]: checking docker-compose is installed ...
✖ Need to install docker-compose(1.18.0+) by yourself first and run this script again.

这时,他会提示报错Need to install docker-compose(1.18.0+) by yourself first and run this script again.提示docker-compose 版本过低,若不报错则执行第五步,
若报错则更新或安装docker-compose

[root@192 harbor]# curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   633  100   633    0     0   1035      0 --:--:-- --:--:-- --:--:--  1034
100 12.1M  100 12.1M    0     0  1191k      0  0:00:10  0:00:10 --:--:-- 1432k
[root@192 harbor]# docker-compose -v
docker-compose version 1.29.2, build 5becea4c

输入docker-compose -v 查看安装是否成功
安装成功后执行下一步

5、安装 harbor 命令

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

[Step 0]: checking if docker is installed ...

Note: docker version: 20.10.8

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

Note: docker-compose version: 1.29.2

[Step 2]: loading Harbor images ...
103076ba7411: Loading layer [==================================================>]  121.2MB/121.2MB
fde3b64438e3: Loading layer [==================================================>]  3.072kB/3.072kB
249a34ecfbe2: Loading layer [==================================================>]   59.9kB/59.9kB
35783e12f32a: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.3.2
7301dee185fe: Loading layer [==================================================>]  8.746MB/8.746MB
Loaded image: goharbor/nginx-photon:v2.3.2
4317ca489899: Loading layer [==================================================>]  8.746MB/8.746MB
d2169f633d64: Loading layer [==================================================>]  11.64MB/11.64MB
cacd32b266bf: Loading layer [==================================================>]  1.688MB/1.688MB
Loaded image: goharbor/harbor-portal:v2.3.2
c3ae7e069c68: Loading layer [==================================================>]  7.359MB/7.359MB
0cfc20b693dd: Loading layer [==================================================>]  4.096kB/4.096kB
4fca387754cd: Loading layer [==================================================>]  3.072kB/3.072kB
3c4496c3ec80: Loading layer [==================================================>]  31.52MB/31.52MB
1fc058950d0e: Loading layer [==================================================>]  11.39MB/11.39MB
4ed942b905a4: Loading layer [==================================================>]   43.7MB/43.7MB
Loaded image: goharbor/trivy-adapter-photon:v2.3.2
a302c582e666: Loading layer [==================================================>]   6.82MB/6.82MB
4dfdb1a3466a: Loading layer [==================================================>]  67.47MB/67.47MB
678180162221: Loading layer [==================================================>]  3.072kB/3.072kB
7241b7d6bd32: Loading layer [==================================================>]  4.096kB/4.096kB
ee4b32ba01a0: Loading layer [==================================================>]  68.26MB/68.26MB
Loaded image: goharbor/chartmuseum-photon:v2.3.2
671f3386d963: Loading layer [==================================================>]  6.816MB/6.816MB
a832248f5584: Loading layer [==================================================>]  6.219MB/6.219MB
7a2ef1cebf21: Loading layer [==================================================>]  14.47MB/14.47MB
51aa675bbc9d: Loading layer [==================================================>]  29.29MB/29.29MB
7e6d06a2bb53: Loading layer [==================================================>]  22.02kB/22.02kB
799b207a8043: Loading layer [==================================================>]  14.47MB/14.47MB
Loaded image: goharbor/notary-signer-photon:v2.3.2
c2660666d3b6: Loading layer [==================================================>]  9.914MB/9.914MB
f64ad03ac62f: Loading layer [==================================================>]  3.584kB/3.584kB
e0552b870e12: Loading layer [==================================================>]   2.56kB/2.56kB
3c2ef908bb96: Loading layer [==================================================>]  73.35MB/73.35MB
f22a7c57e296: Loading layer [==================================================>]  5.632kB/5.632kB
6788f0f8bfd7: Loading layer [==================================================>]   93.7kB/93.7kB
cb5eff88e3c0: Loading layer [==================================================>]  11.78kB/11.78kB
9cf98131b83d: Loading layer [==================================================>]  74.25MB/74.25MB
9ffcc54d3726: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.3.2
c01617f475a3: Loading layer [==================================================>]  125.4MB/125.4MB
a107f03b1efa: Loading layer [==================================================>]  3.584kB/3.584kB
e224182b3157: Loading layer [==================================================>]  3.072kB/3.072kB
caa213381dfb: Loading layer [==================================================>]   2.56kB/2.56kB
dd7c9a10421f: Loading layer [==================================================>]  3.072kB/3.072kB
e104b65b19d1: Loading layer [==================================================>]  3.584kB/3.584kB
cca35c852e5b: Loading layer [==================================================>]  19.97kB/19.97kB
Loaded image: goharbor/harbor-log:v2.3.2
f85726ba84dc: Loading layer [==================================================>]  6.821MB/6.821MB
a056039f5f6d: Loading layer [==================================================>]  4.096kB/4.096kB
c90e384ee5a4: Loading layer [==================================================>]  19.02MB/19.02MB
166cfc19ad5d: Loading layer [==================================================>]  3.072kB/3.072kB
9b458167a646: Loading layer [==================================================>]  25.44MB/25.44MB
2a481503dae1: Loading layer [==================================================>]  45.24MB/45.24MB
Loaded image: goharbor/harbor-registryctl:v2.3.2
6b9b715ecb6e: Loading layer [==================================================>]  9.914MB/9.914MB
8ac2885dd0bc: Loading layer [==================================================>]  17.72MB/17.72MB
3cd80dd3cb0c: Loading layer [==================================================>]  4.608kB/4.608kB
7c944a564b1f: Loading layer [==================================================>]  18.51MB/18.51MB
Loaded image: goharbor/harbor-exporter:v2.3.2
b414ebcb4508: Loading layer [==================================================>]  6.816MB/6.816MB
cd880de5aa45: Loading layer [==================================================>]  6.219MB/6.219MB
1031af43c4d0: Loading layer [==================================================>]  15.88MB/15.88MB
fcd9b76b6247: Loading layer [==================================================>]  29.29MB/29.29MB
a32b5e8b89c2: Loading layer [==================================================>]  22.02kB/22.02kB
af9265555a5b: Loading layer [==================================================>]  15.88MB/15.88MB
Loaded image: goharbor/notary-server-photon:v2.3.2
Loaded image: goharbor/prepare:v2.3.2
571889b5abe7: Loading layer [==================================================>]  1.096MB/1.096MB
b8a1c2a0e296: Loading layer [==================================================>]  5.888MB/5.888MB
99e396e6432d: Loading layer [==================================================>]  173.6MB/173.6MB
58ae8b6bde55: Loading layer [==================================================>]  15.34MB/15.34MB
c61cba7d6edf: Loading layer [==================================================>]  4.096kB/4.096kB
811ccbc829a3: Loading layer [==================================================>]  6.144kB/6.144kB
f35f22870f37: Loading layer [==================================================>]  3.072kB/3.072kB
2b725cdc2563: Loading layer [==================================================>]  2.048kB/2.048kB
f2ac0b4b02e3: Loading layer [==================================================>]   2.56kB/2.56kB
db59c776f906: Loading layer [==================================================>]   2.56kB/2.56kB
b0306a6e97d4: Loading layer [==================================================>]   2.56kB/2.56kB
46283a1471c9: Loading layer [==================================================>]  8.704kB/8.704kB
Loaded image: goharbor/harbor-db:v2.3.2
d7d543260996: Loading layer [==================================================>]  9.914MB/9.914MB
fb7ca2ddf03a: Loading layer [==================================================>]  3.584kB/3.584kB
23c842c0e703: Loading layer [==================================================>]   2.56kB/2.56kB
07d33224975b: Loading layer [==================================================>]  82.47MB/82.47MB
c1ab2a452194: Loading layer [==================================================>]  83.26MB/83.26MB
Loaded image: goharbor/harbor-jobservice:v2.3.2
242e29e7d4c6: Loading layer [==================================================>]  6.821MB/6.821MB
8fcdb8b505d0: Loading layer [==================================================>]  4.096kB/4.096kB
f5f2693cdb62: Loading layer [==================================================>]  3.072kB/3.072kB
09c19ab2448d: Loading layer [==================================================>]  19.02MB/19.02MB
3a12ffe8175d: Loading layer [==================================================>]  19.81MB/19.81MB
Loaded image: goharbor/registry-photon:v2.3.2


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /data/soft/harbor/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



[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db     ... done
Creating harbor-portal ... done
Creating redis         ... done
Creating registryctl   ... done
Creating registry      ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done
✔ ----Harbor has been installed and started successfully.----
[root@192 harbor]# 
[root@192 harbor]# docker ps -a
CONTAINER ID   IMAGE                                COMMAND                  CREATED       STATUS                 PORTS                                   NAMES
a0be2845e66a   goharbor/harbor-jobservice:v2.3.2    "/harbor/entrypoint.…"   2 hours ago   Up 2 hours (healthy)                                           harbor-jobservice
b4232ee15ca9   goharbor/nginx-photon:v2.3.2         "nginx -g 'daemon of…"   2 hours ago   Up 2 hours (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp   nginx
e83fa239a4f0   goharbor/harbor-core:v2.3.2          "/harbor/entrypoint.…"   2 hours ago   Up 2 hours (healthy)                                           harbor-core
5e1cf2582256   goharbor/redis-photon:v2.3.2         "redis-server /etc/r…"   2 hours ago   Up 2 hours (healthy)                                           redis
8c33e6d9bc9b   goharbor/registry-photon:v2.3.2      "/home/harbor/entryp…"   2 hours ago   Up 2 hours (healthy)                                           registry
f8028913396e   goharbor/harbor-registryctl:v2.3.2   "/home/harbor/start.…"   2 hours ago   Up 2 hours (healthy)                                           registryctl
51284edbfb0d   goharbor/harbor-portal:v2.3.2        "nginx -g 'daemon of…"   2 hours ago   Up 2 hours (healthy)                                           harbor-portal
b0aa87e267b0   goharbor/harbor-db:v2.3.2            "/docker-entrypoint.…"   2 hours ago   Up 2 hours (healthy)                                           harbor-db
dcd968080ad0   goharbor/harbor-log:v2.3.2           "/bin/sh -c /usr/loc…"   2 hours ago   Up 2 hours (healthy)   127.0.0.1:1514->10514/tcp               harbor-log
[root@192 harbor]# 

以上侧代表安装成功
通过页面访问http://ip:端口如下

3、使用harbor,将docker镜像推送至镜像仓库

1、在客户端添加镜像仓库

如我的harbor在196.168.222.21上,我需要将196.168.222.21:80的服务器的docker镜像推送到21上,则需

[root@host20 ~]# vi /etc/docker/daemon.json
[root@host20 ~]# cat /etc/docker/daemon.json
{
 "registry-mirrors":[
  "https://reg-mirror.qiniu.com/",
  "https://hub-mirror.c.163.com/",
  "https://docker.mirrors.ustc.edu.cn/",
  "196.168.222.21:80"
 ]
}
[root@host20 ~]# systemctl daemon-reload
[root@host20 ~]# systemctl restart docker
[root@host20 ~]# docker login 192.168.222.21:80
Username: admin
Password: Harbor123
[root@host20 ~]# docker tag docker.elastic.co/elasticsearch/elasticsearch:7.14.1 196.168.222.21:80/library/docker.elastic.co/elasticsearch/elasticsearch:7.14.1
[root@host20 ~]# docker push 196.168.222.21:80/library/docker.elastic.co/elasticsearch/elasticsearch:7.14.1

4、客户端中操作

1 注册docker镜像服务地址

[root@host20 ~]# vi /etc/docker/daemon.json
[root@host20 ~]# cat /etc/docker/daemon.json
{ 
        "insecure-registries":["http://192.168.222.21:80"] 
}
[root@host20 ~]# systemctl daemon-reload
[root@host20 ~]# systemctl restart docker

systemctl daemon-reloadsystemctl restart docker缺一不可不可直接跳过第一步骤走第二步骤。否则不能成功。

2 登录docker仓库

[root@host20 ~]# docker login http://192.168.222.21:80
Username: admin
Password: Harbor123 #输入密码
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

5、停止、 重启harbor

[root@host21 harbor]# docker-compose -f /data/soft/harbor/harbor/docker-compose.yml stop
[root@host21 harbor]# docker-compose -f /data/soft/harbor/harbor/docker-compose.yml start

docker-compose.yml 文件为配置文件必须加载,否则报错
若不知道安装位置则可执行全局搜索

[root@host21 harbor]# find / -name docker-compose.yml
find: ‘/run/user/1000/gvfs’: Permission denied
/data/soft/harbor/harbor/docker-compose.yml
[root@host21 harbor]# 

6、开启service

[root@host21 data]# vi /etc/systemd/system/harbor.service
[root@host21 data]# cat /etc/systemd/system/harbor.service
[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor

[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/bin/docker-compose -f /data/soft/harbor/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /data/soft/harbor/harbor/docker-compose.yml down

[Install]
WantedBy=multi-user.target
[root@host21 data]# /usr/local/bin/docker-compose -v
docker-compose version 1.29.2, build 5becea4c
[root@host21 data]# cd /etc/systemd/system
[root@host21 system]# chmod +x harbor.service
[root@host21 system]# systemctl enable harbor.service
Created symlink from /etc/systemd/system/multi-user.target.wants/harbor.service to /etc/systemd/system/harbor.service.
[root@host21 system]# systemctl status harbor.service
● harbor.service - Harbor
   Loaded: loaded (/etc/systemd/system/harbor.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://github.com/vmware/harbor
[root@host21 system]# systemctl start harbor.service
[root@host21 system]# systemctl enable harbor.service
[root@host21 system]# systemctl status harbor.service
● harbor.service - Harbor
   Loaded: loaded (/etc/systemd/system/harbor.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-09-22 08:20:16 PDT; 21s ago
     Docs: http://github.com/vmware/harbor
 Main PID: 104030 (docker-compose)
   CGroup: /system.slice/harbor.service
           ├─104030 /usr/local/bin/docker-compose -f /data/soft/harbor/harbor/docker-compose.yml...
           └─104039 /usr/local/bin/docker-compose -f /data/soft/harbor/harbor/docker-compose.yml...

Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...2 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...1 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...1 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...2 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...1 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...1 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...2 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /i18n/l...2 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /dark-t...7 .
Sep 22 08:20:18 host21 docker-compose[104030]: nginx          | 192.168.222.21 - "GET /3-es20...1 .
Hint: Some lines were ellipsized, use -l to show in full.
[root@host21 system]# systemctl stop harbor.service
[root@host21 system]# systemctl status harbor.service

7、docker 登录报错

[root@host22 docker]# docker login 192.168.222.21
Username: admin
Password: 
Error response from daemon: Get "https://192.168.222.21/v2/": dial tcp 192.168.222.21:443: connect: connection refused

修复方式
修改文件daemon.json

[root@host21 docker]# vim /etc/docker/daemon.json
{
"registry-mirrors":[
  "https://reg-mirror.qiniu.com/",
  "https://hub-mirror.c.163.com/",
  "https://docker.mirrors.ustc.edu.cn/"
 ],
 "insecure-registries": ["192.168.222.21"]
}

重启命令

[root@host21 harbor]# cd /data/soft/harbor/harbor
[root@host21 harbor]# docker-compose down -v
Stopping nginx             ... done
Stopping harbor-jobservice ... done
Stopping harbor-core       ... done
Stopping harbor-db         ... done
Stopping registry          ... done
Stopping registryctl       ... done
Stopping redis             ... done
Stopping harbor-portal     ... done
Stopping harbor-log        ... done
Removing nginx             ... done
Removing harbor-jobservice ... done
Removing harbor-core       ... done
Removing harbor-db         ... done
Removing registry          ... done
Removing registryctl       ... done
Removing redis             ... done
Removing harbor-portal     ... done
Removing harbor-log        ... done
Removing network harbor_harbor
[root@host21 harbor]# docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db     ... done
Creating registry      ... done
Creating harbor-portal ... done
Creating redis         ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
[root@host21 harbor]# systemctl daemon-reload
[root@host21 harbor]# systemctl restart docker
[root@host22 docker]# docker login 192.168.222.21
Username: admin
Password: Harbor123
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@host22 docker]# docker images
REPOSITORY                TAG         IMAGE ID       CREATED        SIZE
mysql                     5.7         1d7aba917169   3 months ago   448MB
rancher/scheduler         v0.8.6      fbedeaddc3e9   2 years ago    248MB
rancher/agent             v1.2.11     1cc7591af4f5   3 years ago    243MB
rancher/net               v0.13.17    f170c38e3763   3 years ago    311MB
rancher/dns               v0.17.4     678bde0de4d2   3 years ago    249MB
rancher/healthcheck       v0.3.8      ce78cf69cc0b   3 years ago    391MB
rancher/metadata          v0.10.4     02104eb6e270   3 years ago    251MB
rancher/network-manager   v0.7.22     13381626c510   3 years ago    256MB
rancher/net               holder      665d9f6e8cc1   4 years ago    267MB
oracle11g                 oracle11g   3fa112fd3642   5 years ago    6.85GB

[root@host22 docker]# docker tag mysql:5.7 192.168.222.21/library/mysql:5.7
[root@host22 docker]# docker push 192.168.222.21/library/mysql:5.7
The push refers to repository [192.168.222.21/library/mysql]
7449e6022786: Pushed 
67536a20af84: Pushed 
b09979068448: Pushed 
71cabb0b234c: Pushed 
89638afc97cd: Pushed 
2eaac5532d44: Pushed 
35e94dafc854: Pushed 
97a2a3481f0d: Pushed 
b2830993d63a: Pushed 
731f7c213603: Pushed 
d000633a5681: Pushed 
5.7: digest: sha256:bd8855544a384f579b6319b41e65044358cf7441968093517f176783de3e5892 size: 2621
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值