Harbor 仓库:安装手册

安装 Docker

请参照:
Linux CentOS7 中 Docker 的安装与升级(在线安装 + 离线安装)

下载 docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
给 docker-compose 添加执行权限
chmod +x /usr/local/bin/docker-compose
测试一下 docker-compose 是否安装成功
docker-compose --version
下载 harbor 安装文件
yum -y install wget
cd /opt
wget https://github.com/goharbor/harbor/releases/download/v2.2.3/harbor-offline-installer-v2.2.3.tgz
解压 harbor
tar -zxvf harbor-offline-installer-v2.2.3.tgz
创建配置文件
cd /opt/harbor
cp harbor.yml.tmpl harbor.yml
vi /opt/harbor/harbor.yml

## 修改为自己的IP地址或者域名
hostname: 192.168.89.128
## 修改HTTP的访问端口
http:
  port: 9999
## 删除下面的https配置
# https related config
## 修改登录Harbor的web端密码(用于管理界面的登录)
harbor_admin_password: 123456
执行安装命令
./install.sh 
访问 Harbor

访问地址:http://192.168.89.128:9999/
用户名:admin
密码:123456
在这里插入图片描述

将Docker镜像上传到Harbor

给镜像打标签

# 查看镜像
docker images
REPOSITORY    TAG     IMAGE ID        CREATED           SIZE
centos-jdk    8u41    12df886253b0    58 minutes ago    608MB

# 给镜像打标签
docker tag centos-jdk:8u41 192.168.89.128:9999/test/centos-jdk:8u41

# 查看我们新打的标签
docker images
REPOSITORY                            TAG     IMAGE ID        CREATED           SIZE
192.168.89.128:9999/test/centos-jdk   8u41    12df886253b0    58 minutes ago    608MB
centos-jdk                            8u41    12df886253b0    58 minutes a

# 推送镜像
docker push 192.168.89.128:9999/test/centos-jdk:8u41
The push refers to repository [192.168.89.128:9999/test/centos-jdk]
Get https://192.168.89.128:9999/v2/: http: server gave HTTP response to HTTPS client
重启Harbor服务
#进入harbor安装目录
cd /opt/harbor
#停止harbor
docker-compose down
#加载配置文件
./prepare
#启动harbor
docker-compose up -d
异常解决
docker push 192.168.89.128:9999/test/centos-jdk:8u41

The push refers to repository [192.168.89.128:9999/test/centos-jdk]
Get https://192.168.89.128:9999/v2/: http: server gave HTTP response to HTTPS client

异常信息:Get https://192.168.89.128:9999/v2/: http: server gave HTTP
response to HTTPS client 解决方法: 把Harbor地址加入到Docker信任列表 vi
/etc/docker/daemon.json 增加下面的内容 “insecure-registries” :
[“192.168.89.128:9999”]

docker push 192.168.89.128:9999/test/centos-jdk:8u4`在这里插入代码片`1

The push refers to repository [192.168.89.128:9999/test/centos-jdk]
unauthorized: unauthorized to access repository: test/centos-jdk, action: push: unauthorized to access repository: test/centos-jdk, action: push

异常信息:unauthorized: unauthorized to access repository: 解决方法: 执行登录操作,登录
harbor [root@localhost harbor]# docker login -u test -p Test123456
192.168.0.130:9999 Login Succeeded

docker push 192.168.89.128:9999/test/centos-jdk:8u41

The push refers to repository [192.168.89.128:9999/test/centos-jdk]
07d19369a67c: Pushed 
8u41: digest: sha256:7b46c2059be28f98e2cab6ad5b8f327f3da91e144bece33d9c91e883c4dbcf70 size: 1578

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值