搭建portus管理docker registry私服

本节课将介绍Docker Registry以及带UI管理的仓库管理软件Portus搭建过程和管理使用。
Portus介绍
Portus(by SUSE)是一个带UI管理的仓库管理软件,用于Docker Registry API(V2)的开源和授权工具,最低要求registry版本是2.1。它可以作为授权服务器和用户界面,用于新一代的 Docker Registry。具有以下优点:

  1. 安全:Portus 实现了最新的Docker Registry中定义的新的授权方案。它允许对你所有的镜像进行细颗粒度控制,你可以决定哪个用户和团队可 push/pull 镜像。
  2. 轻松管理用户:在Portus映射你的公司,可以定义任意数量的Team,并从Team添加和移除用户。Team有三种类型的用户:Viewers,只能pull镜像;Contributors,可以push/pull镜像;Owners,类似contributors,但可以从 team 添加或移除用户。
  3. 搜索:Portus 提供你的私人注册表的内容的预览,同时有一个快速搜索镜像的功能。
  4. 审计:用户的所有相关事件都会被Portus自动记录,并可被管理员进行用户分析。

Docker & Registry安装步骤:
1、安装CentOS 7.2
2、更新系统

# yum update -y

3、安装docker-compose

# yum -y install epel-release    #pip安装包在epel源中
# yum -y install python-pip
# pip install -U docker-compose

4、安装git客户端

# yum install -y git

5、配置Docker安装源

# vi /etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=
https://yum.dockerproject.org/gpg

6、安装docker引擎并启动

# yum clean all && yum makecache
# yum install -y docker-engine
# systemctl start docker.service
# systemctl enable docker.service

ps:在执行yum install -y docker-engine 时可能会出现“从 https://yum.dockerproject.org/gpg 获取GPG 密钥失败”的问题,别着急,首先在本地电脑中打开https://yum.dockerproject.org/gpg网页将gpg文件下载下来,然后执行:

 # vi /usr/local/docker.gpg //将本地下载的gpg文件复制到该文件中
 # rmp --import /usr/local/docker.gpg

然后就可以顺利安装了

7、安装Portus

# git clone https://github.com/SUSE/Portus.git
# cd Portus/
# ./compose-setup.sh -e 192.168.93.128

ps:在执行此步骤时可能会出现找不到compose-setup.sh这个文件,因为在https://github.com/SUSE/Portus.git网页自动clone的可能是master文件,这就需要我们自己首先在https://github.com/SUSE/Portus/tree/v2.3上把文件下载到本地,然后通过ssh传输到所需系统中即可。

安装过程中会下载registry、mariadb、rails、ports_web等几个docker镜像。
如果网络不好可以先下载对应的几个docker镜像文件
然后上传到portus服务器上并用docker load命令加载。
(镜像的具体版本号以实际为准)
REPOSITORY TAG IMAGE ID CREATED SIZE

安装过后会给出相应的登陆信息和客户端需要的操作样例

###################
#     SUCCESS     #
###################

Make sure port 3000 and 5000 are open on host 192.168.93.128

Open http://192.168.93.128:3000 wit
h your browser and perform the following steps:
  1. Create an admin account
  2. You will be redirected to a page where you have to register the registry. In this form:
    - Choose a custom name for the registry.
    - Enter 192.168.93.128:5000 as the hostname.
    - Do *not* check the "U
se SSL" checkbox, since this setup is not using SSL.
Perform the following actions on the d
ocker hosts that need to interact with your registry:
  - Ensure the docker daemon is started with the ‘--insecure-registry 192.168.93.128:5000‘
  - Perform the docker login.

To authenticate against your registry using the docker cli do:

$ docker login -u <portus username> -p <password> -e <email> 192.168.93.128:5000



To push an image to the private registry:
# docker pull busybox
# docker tag busybox 192.168.93.128:5000/<username>busybox
# docker push 192.168.93.128:5000/<username>busybox

8、打开防火墙端口

#firewall-cmd --zone=public  --add-port=3000/tcp --permanent
#firewall-cmd --zone=public  --add-port=5000/tcp --permanent
#systemctl restart firewall.service

9、Portus初始化
在浏览器中打开创建默认管理员用户
连接到本docker仓库(也可以是其他仓库,必须是registry 2.0以上版本)
10、上传镜像测试
修改文件/lib/systemd/system/docker.service中的ExecStart增加

#--insecure-registry 192.168.93.128:5000

并重启docker服务

#systemctl daemon-reload
#systemctl restart docker.service

检查docker服务

# ps -ef|grep insecure-registry
root 29486 1 0 01:32? 00:00:00 /usr/bin/dockerd --insecure-registry 192.168.93.128:5000

下载busybox镜像并上传到私有的仓库中(安装结束时有操作提示)

# docker pull busybox
# docker tag busybox 192.168.93.128:5000/admin/busybox
# docker login -u admin -p admin123 192.168.93.128:5000
# docker push 192.168.93.128:5000/admin/busybox

检查Portus界面的镜像信息
11、服务器重启后处理
应该先启动

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值