CentOS部署Harbor镜像仓库,java技术栈
2021/11/11 7:13:40
本文主要是介绍CentOS部署Harbor镜像仓库,java技术栈,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Now you should be able to visit the admin portal at http://192.168.50.167.
For more details, please visit https://github.com/goharbor/harbor .
- 此时应该有九个容器正常运行:
[root@vostro ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dac02ab21a1f goharbor/harbor-jobservice:v1.9.0 “/harbor/harbor_jobs…” 3 hours ago Up 3 hours (healthy) harbor-jobservice
998fa5676a08 goharbor/nginx-photon:v1.9.0 “nginx -g 'daemon of…” 3 hours ago Up 3 hours (healthy) 0.0.0.0:80->8080/tcp nginx
bc87d9a5a7f7 goharbor/harbor-core:v1.9.0 “/harbor/harbor_core” 3 hours ago Up 3 hours (healthy) harbor-core
ce495560ef35 goharbor/harbor-db:v1.9.0 “/docker-entrypoint.…” 3 hours ago Up 3 hou
【一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义】 浏览器打开:qq.cn.hn/FTf 免费领取
rs (healthy) 5432/tcp harbor-db
25a13fddd607 goharbor/harbor-portal:v1.9.0 “nginx -g 'daemon of…” 3 hours ago Up 3 hours (healthy) 8080/tcp harbor-portal
b9f72d4da022 goharbor/redis-photon:v1.9.0 “redis-server /etc/r…” 3 hours ago Up 3 hours (healthy) 6379/tcp redis
3804003153ae goharbor/harbor-registryctl:v1.9.0 “/harbor/start.sh” 3 hours ago Up 3 hours (healthy) registryctl
d8d570e88874 goharbor/registry-photon:v2.7.1-patch-2819-v1.9.0 “/entrypoint.sh /etc…” 3 hours ago Up 3 hours (healthy) 5000/tcp registry
2d940d7fd271 goharbor/harbor-log:v1.9.0 “/bin/sh -c /usr/loc…” 3 hours ago Up 3 hours (healthy) 127.0.0.1:1514->10514/tcp harbor-log
- 由于Harbor的web服务使用了宿主机的80端口,所以在浏览器直接输入宿主机的IP地址即可访问Harbor的web管理页面,账号是admin,密码是前面设置的harbor_admin_password的值(默认是Harbor12345):
- 登录成功后发现空空如也,也是,目前还没啥东西:
允许http连接
接下来我们要验证Harbor服务是否可用,验证方式是从另一台Linux电脑(下面称之为A电脑)远程推送镜像到Harbor机器;
Harbor默认是不允许http连接的,这里可以修改设置来支持http连接,以便后续的验证操作;
-
如果要从A电脑连接Harbor服务器,那么要对A电脑做设置,这里A电脑是Linux操作系统;
-
编辑A电脑的/etc/docker/daemon.json文件(如果不存在就新建),增加以下内容,192.168.50.167是Harbor服务器的IP地址:
{
“insecure-registries”:[“192.168.50.167”]
}
- 重启使配置生效:
systemctl daemon-reload && systemctl restart docker
再次提醒:这里修改是远程连接Harbor服务的机器的配置,而不是Harbor服务器的配置;
推送镜像到Harbor
接下来验证Harbor的服务,在A电脑上尝试将本机的镜像推送到Harbor;
- 登录A电脑,选个本地镜像用来测试,我这里有个名为jenkinsci/blueocean:1.19.0的本地镜像,ID为11e2757c8bc1:
root@hedy:~# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkinsci/blueocean 1.19.0 11e2757c8bc1 7 days ago 553MB
- 执行以下命令,将选定的本地镜像修改名称和TAG:
docker tag 11e2757c8bc1 192.168.50.167/library/jenkinsci/blueocean:1.19.0
上述命令中,192.168.50.167是安装harbor的时候,harbor.yml文件中配置的hostname的值,library是harbor默认的项目名称;
3. 执行以下命令即可从A电脑登录Harbor:
docker login 192.168.50.167 -u admin -p Harbor12345
- 执行命令docker push 192.168.50.167/library/jenkinsci/blueocean:1.19.0
root@hedy:~# docker push 192.168.50.167/library/jenkinsci/blueocean:1.19.0
The push refers to repository [192.168.50.167/library/jenkinsci/blueocean]
2963284ab4ce: Pushing [================================================> ] 58.27MB/60.25MB
c4a4de444fad: Pushing [========> ] 47.87MB/267.6MB
850b4f512dc8: Pushed
abdaf43f94b6: Pushed
a6a27b82134d: Pushed
d6bee87a74b8: Pushed
28c6bdb5fda9: Pushed
这篇关于CentOS部署Harbor镜像仓库,java技术栈的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-16ShardingSphere 如何完美驾驭分布式事务与 XA 协议?
- 2024-11-16ShardingSphere如何轻松驾驭Seata柔性分布式事务?
- 2024-11-16Maven资料入门指南
- 2024-11-16Maven资料入门教程
- 2024-11-16MyBatis Plus资料:新手入门教程与实践指南
- 2024-11-16MyBatis-Plus资料入门教程:快速上手指南
- 2024-11-16Mybatis资料入门教程:新手必看指南
- 2024-11-16MyBatis资料详解:新手入门与初级实战指南
- 2024-11-16MyBatisPlus资料:初学者入门指南与实用教程
- 2024-11-16MybatisPlus资料详解:初学者入门指南