docker之企业级镜像仓库Harbor
Harbor概述
Harbor部署
Harbor安装有3种方式:
Harbor部署
包路径: 链接:https://pan.baidu.com/s/1QhCjEAoEepqELhm9IvMOTA
有了harbor就不需要连外网下载镜像了。harbor一般部署在宿主机上。
我们将harbor的包上传到主机上,解压,配置。需要修改一下访问地址,我们这里配置成本机ip,修改一下密码,默认登录密码Harbor12345 。
[root@mcwk8s01 ~]# ls
anaconda-ks.cfg harbor-offline-installer-v1.6.1.tgz keepalived.conf nginx.sh
[root@mcwk8s01 ~]# tar xf harbor-offline-installer-v1.6.1.tgz
[root@mcwk8s01 ~]# ls
anaconda-ks.cfg harbor harbor-offline-installer-v1.6.1.tgz keepalived.conf nginx.sh
[root@mcwk8s01 ~]# cd harbor/
[root@mcwk8s01 harbor]# ls
common docker-compose.chartmuseum.yml docker-compose.clair.yml docker-compose.notary.yml docker-compose.yml ha harbor.cfg harbor.v1.6.1.tar.gz install.sh LICENSE NOTICE open_source_license prepare
[root@mcwk8s01 harbor]# vim harbor.cfg
[root@mcwk8s01 harbor]# egrep "10.0.0.31|Harbor12345" harbor.cfg
hostname = 10.0.0.31
harbor_admin_password = Harbor12345
[root@mcwk8s01 harbor]#
如果需要使用https那修改下配置:ui_url_protocol = http
它是使用docker compose来编排部署的。所以我们可以去去下载一个。安装方式如下链接参考
因为harbor自己要起nginx,会占用80服务,我们主机1上有nginx。那么我们换到主机5上面去把=吧
[root@mcwk8s01 harbor]# scp /usr/local/bin/docker-compose 10.0.0.35:/usr/local/bin/
root@10.0.0.35's password:
docker-compose 100% 10MB 23.5MB/s 00:00
[root@mcwk8s01 harbor]# ls
common docker-compose.chartmuseum.yml docker-compose.clair.yml docker-compose.notary.yml docker-compose.yml ha harbor.cfg harbor.v1.6.1.tar.gz install.sh LICENSE NOTICE open_source_license prepare
[root@mcwk8s01 harbor]# cd ..
[root@mcwk8s01 ~]# ls
anaconda-ks.cfg harbor harbor-offline-installer-v1.6.1.tgz keepalived.conf nginx.sh
[root@mcwk8s01 ~]# scp -rp harbor 10.0.0.35:/root/
root@10.0.0.35's password:
nginx.https.conf 100% 3045 3.7MB/s 00:00
notary.server.conf
./prepare
[root@mcwk8s05 harbor]# ls
common docker-compose.chartmuseum.yml docker-compose.clair.yml docker-compose.notary.yml docker-compose.yml ha harbor.cfg harbor.v1.6.1.tar.gz install.sh LICENSE NOTICE open_source_license prepare
[root@mcwk8s05 harbor]# ./prepare
Generated and saved secret to file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/registryctl/env
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.
[root@mcwk8s05 harbor]#
./install.sh
[root@mcwk8s05 harbor]# ./install.sh [Step 0]: checking installation environment ... Note: docker version: 20.10.21 Note: docker-compose version: 1.21.0 [Step 1]: loading Harbor images ...
ad50e89f4922: Loading layer [==================================================>] 133.4MB/133.4MB
8c9a00a7f290: Loading layer [==================================================>] 73.29MB/73.29MB
078e22641f73: Loading layer [==================================================>] 3.584kB/3.584kB
5494f0d704cb: Loading layer [==================================================>] 3.072kB/3.072kB
34c7e304d18b: Loading layer [==================================================>] 4.096kB/4.096kB
ae9209f78c11: Loading layer [==================================================>] 3.584kB/3.584kB
1498359f7391: Loading layer [==================================================>] 9.728kB/9.728kB
Loaded image: goharbor/harbor-log:v1.6.1
bb738fd5b202: Loading layer [==================================================>] 23.38MB/23.38MB
51f6c7e046ae: Loading layer [==================================================>] 21.15MB/21.15MB
67ff79ae8340: Loading layer [==================================================>] 21.15MB/21.15MB
Loaded image: goharbor/harbor-jobservice:v1.6.1
b5be864bae6a: Loading layer [==================================================>] 83.89MB/83.89MB
9fdbae37c606: Loading layer [==================================================>] 3.072kB/3.072kB
c24b06c70085: Loading layer [==================================================>] 59.9kB/59.9kB
946c040a69da: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v1.6.1
747ac74b0475: Loading layer [==================================================>] 5.128MB/5.128MB
Loaded image: goharbor/nginx-photon:v1.6.1
3d4aae33f4f1: Loading layer [==================================================>] 683MB/683MB
3cb271cda7e0: Loading layer [==================================================>] 7.68kB/7.68kB
7ae402931bdb: Loading layer [==================================================>] 197.6kB/197.6kB
Loaded image: goharbor/harbor-migrator:v1.6.1
67747a74e108: Loading layer [==================================================>] 158.1MB/158.1MB
93f3d22257c7: Loading layer [==================================================>] 35.08MB/35.08MB
2eda636f347b: Loading layer [==================================================>] 2.56kB/2.56kB
7a3b4ef015e8: Loading layer [==================================================>] 35.08MB/35.08MB
Loaded image: goharbor/chartmuseum-photon:v0.7.1-v1.6.1
038c23438769: Loading layer [==================================================>] 23.38MB/23.38MB
a6a0201bf457: Loading layer [==================================================>] 26.88MB/26.88MB
aa0986b7d608: Loading layer [==================================================>] 7.168kB/7.168kB
830a350d7059: Loading layer [==================================================>] 11.32MB/11.32MB
3100afecce3d: Loading layer [==================================================>] 26.87MB/26.87MB
Loaded image: goharbor/harbor-ui:v1.6.1
15134eb6d277: Loading layer [==================================================>] 95.85MB/95.85MB
02cff5f31ca4: Loading layer [==================================================>] 6.656kB/6.656kB
3e43f3cb1d4c: Loading layer [==================================================>] 2.048kB/2.048kB
4ab1b74a5650: Loading layer [==================================================>] 7.68kB/7.68kB
9c78faccbd48: Loading layer [==================================================>] 2.56kB/2.56kB
158d4a16071f: Loading layer [==================================================>] 2.56kB/2.56kB
6a2fbfb6100b: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-db:v1.6.1
b15fe66f326a: Loading layer [==================================================>] 23.38MB/23.38MB
336e69120569: Loading layer [==================================================>] 3.072kB/3.072kB
f308142e2037: Loading layer [==================================================>] 3.072kB/3.072kB
3119c7884a49: Loading layer [==================================================>] 2.048kB/2.048kB
fafa9955d095: Loading layer [==================================================>] 22.8MB/22.8MB
4c53b946082a: Loading layer [==================================================>] 22.8MB/22.8MB
Loaded image: goharbor/registry-photon:v2.6.2-v1.6.1
0fee5e457010: Loading layer [==================================================>] 23.38MB/23.38MB
6d1b402441fc: Loading layer [==================================================>] 12.16MB/12.16MB
765a288fcf5a: Loading layer [==================================================>] 17.3MB/17.3MB
da4578643aee: Loading layer [==================================================>] 11.26kB/11.26kB
f02d275fa76f: Loading layer [==================================================>] 3.072kB/3.072kB
4a3d1e973223: Loading layer [==================================================>] 29.46MB/29.46MB
Loaded image: goharbor/notary-server-photon:v0.5.1-v1.6.1
918b224a19fd: Loading layer [==================================================>] 10.95MB/10.95MB
ff41acdef199: Loading layer [==================================================>] 17.3MB/17.3MB
4389d5e9282a: Loading layer [==================================================>] 11.26kB/11.26kB
8a0e0bb6ed63: Loading layer [==================================================>] 3.072kB/3.072kB
d437ffa494e0: Loading layer [==================================================>] 28.24MB/28.24MB
Loaded image: goharbor/notary-signer-photon:v0.5.1-v1.6.1
1c86e9f19207: Loading layer [==================================================>] 158.1MB/158.1MB
3b4698fe61a0: Loading layer [==================================================>] 10.93MB/10.93MB
8dbd6d55a6cd: Loading layer [==================================================>] 2.048kB/2.048kB
5cb748f1dcf1: Loading layer [==================================================>] 48.13kB/48.13kB
f86a42ee549b: Loading layer [==================================================>] 10.98MB/10.98MB
Loaded image: goharbor/clair-photon:v2.0.6-v1.6.1
18abf81cd9fd: Loading layer [==================================================>] 23.38MB/23.38MB
66a3e670c5b5: Loading layer [==================================================>] 15.58MB/15.58MB
9cdd51a1e20c: Loading layer [==================================================>] 15.36kB/15.36kB
9aedba3496f1: Loading layer [==================================================>] 15.58MB/15.58MB
Loaded image: goharbor/harbor-adminserver:v1.6.1 [Step 2]: preparing environment ...
Clearing the configuration file: ./common/config/adminserver/env
Clearing the configuration file: ./common/config/ui/env
Clearing the configuration file: ./common/config/ui/app.conf
Clearing the configuration file: ./common/config/ui/private_key.pem
Clearing the configuration file: ./common/config/db/env
Clearing the configuration file: ./common/config/jobservice/env
Clearing the configuration file: ./common/config/jobservice/config.yml
Clearing the configuration file: ./common/config/registry/config.yml
Clearing the configuration file: ./common/config/registry/root.crt
Clearing the configuration file: ./common/config/registryctl/env
Clearing the configuration file: ./common/config/registryctl/config.yml
Clearing the configuration file: ./common/config/nginx/nginx.conf
Clearing the configuration file: ./common/config/log/logrotate.conf
loaded secret from file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/registryctl/env
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service. [Step 3]: checking existing instance of Harbor ... [Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis ... done
Creating registry ... done
Creating harbor-adminserver ... done
Creating harbor-db ... done
Creating harbor-ui ... done
Creating nginx ... done
Creating harbor-jobservice ... done ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://10.0.0.31.
For more details, please visit https://github.com/goharbor/harbor . [root@mcwk8s05 harbor]#
查看导入的镜像
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest bc01a3326866 11 days ago 1.24MB
nginx latest 76c69feac34e 12 days ago 142MB
nginx 1.14 295c7be07902 3 years ago 109MB
nginx 1.14.2 295c7be07902 3 years ago 109MB
goharbor/chartmuseum-photon v0.7.1-v1.6.1 f0a2dbee1ff1 4 years ago 350MB
goharbor/harbor-migrator v1.6.1 60e8be845b35 4 years ago 798MB
goharbor/redis-photon v1.6.1 6a67380bb061 4 years ago 210MB
goharbor/clair-photon v2.0.6-v1.6.1 c4fcdbae7df2 4 years ago 302MB
goharbor/notary-server-photon v0.5.1-v1.6.1 f1afd44d9f9b 4 years ago 209MB
goharbor/notary-signer-photon v0.5.1-v1.6.1 83aa51867207 4 years ago 207MB
goharbor/registry-photon v2.6.2-v1.6.1 f4cb5e83f0a4 4 years ago 196MB
goharbor/nginx-photon v1.6.1 9ca888fe33b2 4 years ago 132MB
goharbor/harbor-log v1.6.1 9b1ea3f29465 4 years ago 198MB
goharbor/harbor-jobservice v1.6.1 9ca6fd371ca6 4 years ago 192MB
goharbor/harbor-ui v1.6.1 305ee5b8952c 4 years ago 215MB
goharbor/harbor-adminserver v1.6.1 a3e95f74984e 4 years ago 181MB
goharbor/harbor-db v1.6.1 3bea3bff0190 4 years ago 219MB
siriuszg/kubernetes-dashboard-amd64 v1.8.3 784cf2722f44 4 years ago 102MB
registry.cn-hangzhou.aliyuncs.com/google-containers/pause-amd64 3.0 99e59f495ffa 6 years ago 747kB
[root@mcwk8s05 harbor]#
运行服务和查看状态:
docker-compose up -d #应该是需要在服务的目录下进行,好像是会读取docker-compose.yml文件去部署
docker-compose ps
[root@mcwk8s05 harbor]# ls
common docker-compose.chartmuseum.yml docker-compose.clair.yml docker-compose.notary.yml docker-compose.yml ha harbor.cfg harbor.v1.6.1.tar.gz install.sh LICENSE NOTICE open_source_license prepare
[root@mcwk8s05 harbor]# docker-compose up -d
harbor-log is up-to-date
redis is up-to-date
registry is up-to-date
harbor-db is up-to-date
harbor-adminserver is up-to-date
harbor-ui is up-to-date
harbor-jobservice is up-to-date
nginx is up-to-date
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]# docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up (healthy)
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-ui /harbor/start.sh Up (healthy)
nginx nginx -g daemon off; Up (healthy) 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:4443->4443/tcp,:::4443->4443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
[root@mcwk8s05 harbor]#
访问地址:http://10.0.0.35/
如下,进入了登录页面了
默认用户 admin
默认用户密码 Harbor12345
登录之后默认有个仓库,是个公共的仓库,我们可以往里面上传镜像。我们主要用的项目和用户。
harbor的基本使用
harbor页面的基本使用
创建用户
ASdf556433377*&&
为项目添加成员(管理员)
推送镜像的参考命令
这个配置的地址有问题,我们之前在31上配置的。传到35上了,但是没有修改配置,配置那么多。我们重新部署一下吧
停止服务
[root@mcwk8s05 harbor]# docker-compose stop
Stopping harbor-jobservice ... done
Stopping nginx ... done
Stopping harbor-ui ... done
Stopping harbor-adminserver ... done
Stopping harbor-db ... done
Stopping registry ... done
Stopping redis ... done
Stopping harbor-log ... done
[root@mcwk8s05 harbor]#
重新部署之后就对了。我是将harbor目录删除了,重新上传的,但是刚刚创建的成员machangwei还在的,看来数据库或者是存储的数据是在别处,没有受到影响吗。
推送镜像到harbor
推送总结
推送案例
如推荐的推送案例,我们需要打上标签,标签地址是我们的项目访问地址,然后push这个有仓库地址标签的镜像
打个标签
[root@mcwk8s05 harbor]# docker images tomcat
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 3500a757f51d 3 days ago 473MB
[root@mcwk8s05 harbor]# docker tag tomcat 10.0.0.35/library/tomcat:v1
[root@mcwk8s05 harbor]# docker images tomcat
REPOSITORY TAG IMAGE ID CREATED SIZE
tomcat latest 3500a757f51d 3 days ago 473MB
[root@mcwk8s05 harbor]# docker images 10.0.0.35/library/tomcat:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
10.0.0.35/library/tomcat v1 3500a757f51d 3 days ago 473MB
[root@mcwk8s05 harbor]#
我们推送镜像需要登录仓库。docker默认是以https方式访问镜像仓库的。我们这里仓库是使用的http的,那么需要在docker配置文件里加上可信任
[root@mcwk8s05 harbor]# ip a|grep 10.0.0.35
inet 10.0.0.35/24 brd 10.0.0.255 scope global eth0
[root@mcwk8s05 harbor]# cat /etc/docker/daemon.json
{"registry-mirrors":["https://reg-mirror.qiniu.com/","https://docker.mirrors.ustc.edu.cn/","https://hub-mirror.c.163.com/"],
"insecure-registries":["10.0.0.35"]
}
[root@mcwk8s05 harbor]# systemctl restart docker
[root@mcwk8s05 harbor]# docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Exit 137
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-ui /harbor/start.sh Up (health: starting)
nginx nginx -g daemon off; Up (health: starting) 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:4443->4443/tcp,:::4443->4443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
redis docker-entrypoint.sh redis ... Exit 128
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
[root@mcwk8s05 harbor]# docker-compose up -d
harbor-log is up-to-date
Starting redis ...
Starting harbor-adminserver ...
Starting redis ... done
Starting harbor-adminserver ... done
harbor-ui is up-to-date
nginx is up-to-date
harbor-jobservice is up-to-date
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]# docker-compose ps
Name Command State Ports
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up (health: starting)
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-ui /harbor/start.sh Up (health: starting)
nginx nginx -g daemon off; Up (health: starting) 0.0.0.0:443->443/tcp,:::443->443/tcp, 0.0.0.0:4443->4443/tcp,:::4443->4443/tcp, 0.0.0.0:80->80/tcp,:::80->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
[root@mcwk8s05 harbor]#
登录仓库并i推送镜像到仓库
[root@mcwk8s05 harbor]# docker login 10.0.0.35
Username: machangwei
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@mcwk8s05 harbor]# docker push 10.0.0.35/library/tomcat:v1
The push refers to repository [10.0.0.35/library/tomcat]
dac98e58cc38: Pushed
052fe235dec6: Pushed
8129280902f4: Pushed
9e5fabf427d2: Pushed
6657f9faac5f: Pushed
3a87162a073c: Pushed
f4a670ac65b6: Pushed
v1: digest: sha256:8aaa923ea3dbd010cf77faf9e9ad0624fe19fcb5a3dae4cb34c235a3150c00cc size: 1788
[root@mcwk8s05 harbor]#
查看harbor仓库上,已经有了刚刚上传的镜像
点击进入,看到推送的信息
我们再把nginx推送上去,把tomcat再推送第二个版本上去。需要注意的是,我们推送前一定要打上我们自己仓库的地址的镜像标签,推送这个有标签的镜像,别直接推送未打标签的,省的推送到别人的仓库了。
[root@mcwk8s05 harbor]# docker images nginx:1.14
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx 1.14 295c7be07902 3 years ago 109MB
[root@mcwk8s05 harbor]# docker images 10.0.0.35/library/tomcat:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
10.0.0.35/library/tomcat v1 3500a757f51d 3 days ago 473MB
[root@mcwk8s05 harbor]# docker tag 10.0.0.35/library/tomcat:v1 10.0.0.35/library/tomcat:v2
[root@mcwk8s05 harbor]# docker images 10.0.0.35/library/tomcat:v2
REPOSITORY TAG IMAGE ID CREATED SIZE
10.0.0.35/library/tomcat v2 3500a757f51d 3 days ago 473MB
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]# docker push nginx:1.14
The push refers to repository [docker.io/library/nginx]
82ae01d5004e: Layer already exists
b8f18c3b860b: Preparing
5dacd731af1b: Preparing
^C
[root@mcwk8s05 harbor]# docker tag nginx:1.14 10.0.0.35/library/nginx:1.14
[root@mcwk8s05 harbor]# docker images 10.0.0.35/library/nginx:1.14
REPOSITORY TAG IMAGE ID CREATED SIZE
10.0.0.35/library/nginx 1.14 295c7be07902 3 years ago 109MB
[root@mcwk8s05 harbor]#
[root@mcwk8s05 harbor]# docker push 10.0.0.35/library/nginx
Using default tag: latest
The push refers to repository [10.0.0.35/library/nginx]
tag does not exist: 10.0.0.35/library/nginx:latest
[root@mcwk8s05 harbor]# docker push 10.0.0.35/library/nginx:1.14
The push refers to repository [10.0.0.35/library/nginx]
82ae01d5004e: Pushed
b8f18c3b860b: Pushed
5dacd731af1b: Pushed
1.14: digest: sha256:706446e9c6667c0880d5da3f39c09a6c7d2114f5a5d6b74a2fafd24ae30d2078 size: 948
[root@mcwk8s05 harbor]# docker push 10.0.0.35/library/tomcat:v2
The push refers to repository [10.0.0.35/library/tomcat]
dac98e58cc38: Layer already exists
052fe235dec6: Layer already exists
8129280902f4: Layer already exists
9e5fabf427d2: Layer already exists
6657f9faac5f: Layer already exists
3a87162a073c: Layer already exists
f4a670ac65b6: Layer already exists
v2: digest: sha256:8aaa923ea3dbd010cf77faf9e9ad0624fe19fcb5a3dae4cb34c235a3150c00cc size: 1788
[root@mcwk8s05 harbor]#
我们再看下,这个仓库中的tomcat有两个版本了
仓库中有两个镜像
我们想要下载指定镜像指定版本的话可以在这里看下载地址,复制命令
比如上面我们复制的是 docker pull 10.0.0.35/library/tomcat:v1
我们在另一台主机,主机6上下载一下。我们下载的主机,由于harbor是http方式的,我们也需要添加配置,让harbor主机是受信任的
[root@mcwk8s06 ~]# docker pull 10.0.0.35/library/tomcat:v1
Error response from daemon: Get "https://10.0.0.35/v2/": dial tcp 10.0.0.35:443: connect: connection refused
[root@mcwk8s06 ~]# vim /etc/docker/daemon.json
[root@mcwk8s06 ~]# cat /etc/docker/daemon.json
{"registry-mirrors":["https://reg-mirror.qiniu.com/","https://docker.mirrors.ustc.edu.cn/","https://hub-mirror.c.163.com/"],
"insecure-registries":["10.0.0.35"]
}
[root@mcwk8s06 ~]# systemctl restart docker
[root@mcwk8s06 ~]#
[root@mcwk8s06 ~]# docker pull 10.0.0.35/library/tomcat:v1
v1: Pulling from library/tomcat
e96e057aae67: Pull complete
014fa72e018d: Pull complete
3c9b94dcf278: Pull complete
4624f8447672: Pull complete
fbaf4e13e099: Pull complete
fe482f3df622: Pull complete
9c389ce12d0e: Pull complete
Digest: sha256:8aaa923ea3dbd010cf77faf9e9ad0624fe19fcb5a3dae4cb34c235a3150c00cc
Status: Downloaded newer image for 10.0.0.35/library/tomcat:v1
10.0.0.35/library/tomcat:v1
[root@mcwk8s06 ~]# docker images 10.0.0.35/library/tomcat:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
10.0.0.35/library/tomcat v1 3500a757f51d 3 days ago 473MB
[root@mcwk8s06 ~]#
docker之企业级镜像仓库Harbor的更多相关文章
- 使用docker搭建“企业级镜像仓库”Harbor
一.前沿 docker的官方镜像仓库registry,功能比较单一,不太好用,特别是删除镜像操作,不够友好. Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一 ...
- 【Docker】企业级镜像仓库harbor的搭建(http/https)及使用
一:用途 Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器. 二:安装docker-ce 环境:阿里云轻量应用服务器CentOS 7.3 这里通过yum Docker源仓 ...
- 企业级镜像仓库harbor搭建
企业级镜像仓库harbor搭建 一. Harbor概述 VMware公司最近开源了企业级Registry项目Harbor,其的目标是帮助用户迅速搭建一个企业级的Docker registry 服 ...
- 企业级镜像仓库 harbor
企业级镜像仓库 harbor 前言 a. 本文主要为 Docker的视频教程 笔记. b. 环境为 CentOS 7.0 云服务器 c. 上一篇:跨 Docker 宿主机网络 overlay 类型 h ...
- Docker: 企业级镜像仓库Harbor的使用
上一节,演示了Harbor的安装部署 这次我们来讲解 Harbor的使用. 我们需要了解到: 1. 如何推镜像到镜像仓库 2. 如何从镜像仓库拉取镜像 3. 如何运行从私有仓库拉取的镜像 # 查看 h ...
- Docker 企业级镜像仓库 Harbor 的搭建与维护
目录 一.什么是 Harbor 二.Harbor 安装 2.1.Harbor 安装环境 2.2.Harbor安装 2.3 配置HTTPS 三.Harbor 的使用 3.1.登录Harbor并使用 3. ...
- docker进阶-搭建私有企业级镜像仓库Harbor
为什么要搭建私有镜像仓库 对于一个刚刚接触Docker的人来说,官方的Docker hub是用于管理公共镜像.既然官方提供了镜像仓库我们为什么还要去自己搭建私有仓库呢?虽然也可以托管私有镜像.我们 ...
- docker企业级镜像仓库Harbor管理
Harbor概述 Harbor是由VMWare公司开源的容器镜像仓库.事实上,Harbor是在Docker Registry上进行了相应的企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括: ...
- 企业级镜像仓库Harbor
介绍: Habor是由VMWare公司开源的容器镜像仓库.事实上,Habor是在Docker Registry上进行了相应的企业级扩展,从而获得了更加广泛的应用,这些新的企业级特性包括:管理用户界面, ...
- docker实战——Docker本地私有镜像仓库Harbor搭建及配置
Harbor介绍 Docker容器应用的开发和运行离不开可靠的镜像管理,虽然docker官方提供了公共的镜像仓库(Docker Hub),但是从安全和效率等方面考虑,部署我们私有环境内的Registr ...
随机推荐
- 深入理解 C# 编程:枚举、文件处理、异常处理和数字相加
C# 枚举 枚举是一个特殊的"类",表示一组常量(不可更改/只读变量). 要创建枚举,请使用 enum 关键字(而不是 class 或 interface),并用逗号分隔枚举项: ...
- CMake 构建指南:如何提高 C/C++ 项目的可维护性
如果您是一位C/C++开发人员,那么您一定知道在编写和维护大型项目时所面临的挑战.这些项目通常包含大量的源代码.库和依赖项,需要耗费大量的时间和精力才能构建和维护.在这种情况下,使用自动化工具可以大大 ...
- Makefile编写模板 & 学习笔记
一.模板 # 伪命令 .PHONY: clean compileSo compileExe run: compileExe @./main compileExe: compileSo @g++ mai ...
- 实战指南:使用 xUnit.DependencyInjection 在单元测试中实现依赖注入【完整教程】
引言 上一篇我们创建了一个Sample.Api项目和Sample.Repository,并且带大家熟悉了一下Moq的概念,这一章我们来实战一下在xUnit项目使用依赖注入. Xunit.Depende ...
- 免费报表工具零代码零基础轻松搞定 web 报表
话说,能制作清单式报表的方式有千千万: 骨灰级的 Excel 控,如果能轻车熟路驾驭 VBA,也能玩出各种花来,再不济借助图表插件外援也能秒杀一众小白选手: 传说中的编程控,只要需求明确没什么做不了的 ...
- mysql 必知必会整理—组合查询与全文搜索[九]
前言 简单整理一下组合查询与全文搜索. 正文 什么是组合查询,就是我们常说的交并补集. 直接上例子. 举一个例子,假如需要价格小于等于5的所有物品的一个列表,而且还想包括供应商1001和1002生产的 ...
- maven 设置阿里镜像[二]
前言 因为我们在国内,网速很慢,所以最好设置一下阿里镜像. 1.在maven中的conf下的setting 修改为: <mirror> <id>alimaven</id& ...
- 【笔记】join using&AVG
oracle using 在oracle中,using用于简化连接查询,只有当查询是等值连接和连接中的列必须具有相同的名称与数据类型时,才能使用using关键字进行简化 比如原来是 select s. ...
- 剑指offer11(Java)-旋转数组中的最小值(简单)
题目: 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转. 给你一个可能存在 重复 元素值的数组 numbers ,它原来是一个升序排列的数组,并按上述情形进行了一次旋转.请返回旋转数 ...
- 力扣665(java)-非递减数列(中等)
题目: 给你一个长度为 n 的整数数组 nums ,请你判断在 最多 改变 1 个元素的情况下,该数组能否变成一个非递减数列. 我们是这样定义一个非递减数列的: 对于数组中任意的 i (0 <= ...