赞
踩
Docker容器应用的开发和运行离不开可靠的镜像管理,虽然Docker官方也提供了公共的镜像仓库,但是从安全和效率等方面考虑,部署我们私有环境内的Registry也是非常必要的。Harbor是由VMware公司开源的企业级的Docker Registry管理项目,它包括权限管理(RBAC)、LDAP、日志审核、管理界面、自我注册、镜像复制和中文支持等功能。
https://github.com/goharbor/harbor/releases
sudo tar -xvf harbor-offline-installer-v1.9.3.tgz
解压后目录
修改配置文件harbor.yml
hostname: 192.168.124.128 (自己本机地址)
port: 1180 (自己定义端口号,记得不要使用80端口)
harbor_admin_password: 12345 (admin进入密码)
第一步:启动准备文件,使用root权限运行,免得权限不够。
sudo ./prepare
第二步启动安装程序
sudo ./install.sh
启动成功显示如下:
http://192.168.124.128:1180 (使用改地址访问) ,密码:12345,之前配置的。
第一步:创建镜像tag。
docker tag mysql:5.7 192.168.124.128:1180/library/mysql:5.7
第二步:上传镜像
docker push 192.168.124.128:1180/library/mysql:5.7
- wxp@ubuntu-128://etc/docker$ docker push 192.168.124.128:1180/gogbee_dev/jenkinsci/blueocean
- The push refers to repository [192.168.124.128:1180/gogbee_dev/jenkinsci/blueocean]
- An image does not exist locally with the tag: 192.168.124.128:1180/gogbee_dev/jenkinsci/blueocean
解决办法,执行以下命令,创建标签:
docker tag jenkinsci/blueocean 192.168.124.128:1180/library/jenkinsci/blueocean
- wxp@ubuntu-129:~$ docker push 192.168.124.128:1180/library/graylog/graylog:3.0
- Error response from daemon: Get https://192.168.124.128:1180/v2/: http: server gave HTTP response to HTTPS client
解决办法:
cd /etc/docker/
修改daemon.json
- {
- "insecure-registries":["192.168.124.128:1180"]
- }
192.168.124.128:1180:ip和端口就是harbor配置的端口和ip。
重启docker 服务。
systemctl restart docker
- wxp@ubuntu-128://etc/docker$ docker push 192.168.124.128:1180/goharbor/mysql:5.7
- The push refers to repository [192.168.124.128:1180/goharbor/mysql]
- 8129a85b4056: Preparing
- 3c376267ac82: Preparing
- fa9efdcb088a: Preparing
- 9e615ff77b4f: Preparing
- e5de8ba20fae: Preparing
- 2bee3420217b: Waiting
- 904af8e2b2d5: Waiting
- daf31ec3573d: Waiting
- da4155a7d640: Waiting
- 3b7c5f5acc82: Waiting
- 295d6a056bfd: Waiting
- denied: requested access to the resource is denied
解决办法:
使用docker登陆到harbor
- wxp@ubuntu-128:/usr/local/share/ca-certificates$ docker login --username=admin 192.168.124.128:1180
- Password:
--username=admin :harbor登录用户。
Password: 12345 (harbor设置密码。)
登录时报错,造成原因:是Ubuntu软件包的一个错误。
sudo apt-get remove golang-docker-credential-helpers
然后正常登录,这样就能推送成功,这样大功告成。
- wxp@ubuntu-128:/usr/local/share/ca-certificates$ docker push 192.168.124.128:1180/library/mysql:5.7
- The push refers to repository [192.168.124.128:1180/library/mysql]
- 8129a85b4056: Pushed
- 3c376267ac82: Pushed
- fa9efdcb088a: Pushed
- 9e615ff77b4f: Pushed
- e5de8ba20fae: Pushed
- 2bee3420217b: Pushed
- 904af8e2b2d5: Pushed
- daf31ec3573d: Pushed
- da4155a7d640: Pushed
- 3b7c5f5acc82: Pushed
- 295d6a056bfd: Pushed
- 5.7: digest: sha256:c0806ac73235043de2a6cb4738bb2f6a74f71d9c7aa0f19c8e7530fd6c299e75 size: 2617
查看harbor如下:
df -h
查看磁盘信息,因为磁盘满了,导致没法上传镜像。
终于大功告成。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。