私有容器仓库Docker Harbor

  1 分钟   3874 字    |    

Docker Harbor

Harbor是构建企业级私有docker镜像的仓库的开源解决方案,它是Docker Registry的更高级封装,提供友好的Web UI界面,角色和用户权限管理,用户操作审计等功能

安装准备

  1. 安装docker
# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# Step 4: 更新并安装Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
# Step 4: 开启Docker服务
sudo service docker start
  1. 安装docker-compose
yum install python3-pip
pip3 install --upgrade pip
pip3 install docker-compose
docker-compose --version

Harbor部署

  1. 下载
## 拉取
wget https://storage.googleapis.com/harbor-releases/release-2.7.0/harbor-offline-installer-v2.7.0.tgz
## 解压
tar zxf harbor-offline-installer-v2.7.0.tgz -C /data/
## 进入
cd /data/harbor/
  1. 配置
# 编辑
vim harbor.yml
# 配置如下
hostname: localhost
port: 8010
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /data/cert/harbor.crt
  private_key: /data/cert/harbor.key
harbor_admin_password: dec2023
# The location to store harbor's data
data_volume: /usr/src/harbor/data
# The directory to store store log
location: /var/log/harbor

## 保存后安装
./install.sh

证书配置

[root@master ~]# mkdir -p /data/cert
[root@master ~]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout /data/cert/harbor.key -x509 -days 365 -out /data/cert/harbor.crt
  1. 界面

发布镜像

本机

  1. 配置:
  • linux:编辑/etc/docker/daemon.json
// 配置要使用的仓库地址 ip和port替换成自己的
{"insecure-registries":["仓库ip:port"]}

// 重新加载daemon
systemctl daemon-reload
// 重启docker
systemctl restart docker
  • mac:image-20230213155412972
  1. 登录
docker login 124.70.97.36:8010
Username: admin
Password:
Login Succeeded
  1. 上传
# 打标签
docker tag nginx:latest 124.70.97.36:8010/test/nginx:latest
# 上传 
docker push 124.70.97.36:8010/test/nginx:latest

参考

[ 1 ] https://github.com/goharbor/harbor

[ 2 ] https://www.jianshu.com/p/467e8cdd9eec

[ 3 ] https://learnku.com/articles/29884

~  ~  The   End  ~  ~


 赏 
感谢您的支持,我会继续努力哒!
支付宝收款码
tips
文章二维码 分类标签:教程docker
文章标题:私有容器仓库Docker Harbor
文章链接:http://120.46.217.131:82/archives/53/
最后编辑:2023 年 3 月 4 日 13:38 By Yang
许可协议: 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
(*) 7 + 9 =
快来做第一个评论的人吧~