Centos7搭建docker仓库

时间:2023-03-08 17:45:15

一:安装启动registry

  1.1:环境准备

    yum install -y python-devel libevent-devel python-pip gcc xz-devel

    pip install docker-registry

  1.2:server端

    [root@k8s-01 ~]# docker pull registry(西游记)

[root@k8s-01 ~]# docker pull registry
Using default tag: latest
Trying to pull repository docker.io/library/registry ...
latest: Pulling from docker.io/library/registry
c87736221ed0: Pull complete
1cc8e0bb44df: Pull complete
54d33bcb37f5: Pull complete
e8afc091c171: Pull complete
b4541f6d3db6: Pull complete

  1.3:浏览器打开http://10.8.8.31:5000/v2/_catalog   

    {"repositories":[]}表示现在仓库中,没有镜像images

Centos7搭建docker仓库

  1.3:启动registry

    默认情况下,会将仓库存放于容器的 /tmp/registry 目录下,如果容器被删除,则数据也会丢失,所以我们可以通过 -v 参数来将镜像文件存放在本地的指定路径:

docker run -itd -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest

  1.4:

感谢:

https://blog.****.net/yejinxiong001/article/details/81944820

https://www.cnblogs.com/purpleraintear/p/6010657.html

TLS认证:

https://www.cnblogs.com/zhaojiankai/p/7813969.html