registry私有仓库搭建
Posted 冬眠的熊哎
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了registry私有仓库搭建相关的知识,希望对你有一定的参考价值。
1.关闭防火墙
[root@registry ~]# systemctl stop firewalld
[root@registry ~]# systemctl disable firewalld
2.关闭selinux
[root@registry ~]# vi /etc/selinux/config
将 SELINUX=enforcing 修改为 SELINUX=disabled
3.安装docker
二、部署registry
1.下载registry镜像
[root@registry ~]# docker pull registry
2.配置registry信息
[root@master1 v2]# vi /etc/docker/daemon.json
"insecure-registries":["192.168.5.128:5000"]
重启docker服务
[root@master1 ~]# systemctl restart docker
3.启动registry容器
[root@registry ~]# docker run ‐d ‐p 5000:5000 ‐v /home/registry:/var/lib/registry ‐‐
restart=always ‐‐privileged=true ‐‐name=registry registry:latest
查看registry容器
[root@master1 ~]# docker ps
fb611b773430 registry:latest "/entrypoint.sh /etc…" About an hour ago Up About an hour 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry
三、测试验证
1.本地镜像push到私有仓库
[root@master1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest d1a364dc548d 3 weeks ago 133MB
2.修改镜像tag
[root@master1 ~]# docker tag nginx:latest 192.168.5.128:5000/nginx:test
3.把修改了tag镜像上传到私有仓库
[root@master1 ~]# docker push 192.168.5.128:5000/nginx:test
The push refers to repository [192.168.5.128:5000/nginx]
075508cf8f04: Layer already exists
5c865c78bc96: Layer already exists
134e19b2fac5: Layer already exists
83634f76e732: Layer already exists
766fe2c3fc08: Layer already exists
02c055ef67f5: Layer already exists
test: digest: sha256:61191087790c31e43eb37caa10de1135b002f10c09fdda7fa8a5989db74033aa size: 1570
4.查询仓库镜像
[root@master1 ~]# curl http://192.168.5.128:5000/v2/_catalog
"repositories":["nginx"]
5.查询仓库里nginx镜像的tag
[root@master1 ~]# curl http://192.168.5.128:5000/v2/nginx/tags/list
"name":"nginx","tags":["test"]
以上是关于registry私有仓库搭建的主要内容,如果未能解决你的问题,请参考以下文章