1、拉取镜像

docker pull registry:2

2、运行

docker run -d -v /usr/local/registry:/var/lib/registry -p 5000:5000 --restart always --name registry registry:2

3、访问

http://192.168.228.147:5000/v2/_catalog

4、推送测试

第一步打标签

[root@bogon ~]# docker tag nginx 192.168.228.147:5000/test:v1
[root@bogon ~]# docker images
REPOSITORY                  TAG       IMAGE ID       CREATED         SIZE
nginx                       latest    605c77e624dd   9 months ago    141MB
192.168.228.147:5000/test   v1        605c77e624dd   9 months ago    141MB
registry                    2         b8604a3fe854   11 months ago   26.2MB

 如果仓库服务器使用的是http,需要配置https访问,linux环境下在/etc/docker/daemon.json添加以下配置

{
"registry-mirrors": ["https://cr.console.aliyun.com/"],
"insecure-registries":["IP:5000"]
}
systemctl daemon-reload && systemctl restart docker &&
docker restart registry

推送

docker push 192.168.228.147:5000/test:v1

 

 测试:    #也需要配置/etc/docker/daemon.json

[root@bogon ~]# docker pull 192.168.228.147:5000/test01
Using default tag: latest
latest: Pulling from test01
a2abf6c4d29d: Pull complete
a9edb18cadd1: Pull complete
589b7251471a: Pull complete
186b1aaa4aa6: Pull complete
b4df32aa5a72: Pull complete
a0bcbecc962e: Pull complete
Digest: sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
Status: Downloaded newer image for 192.168.228.147:5000/test01:latest
192.168.228.147:5000/test01:latest
[root@bogon ~]# docker images
REPOSITORY                    TAG       IMAGE ID       CREATED         SIZE
192.168.228.147:5000/test01   latest    605c77e624dd   9 months ago    141MB

 docker-registry-browser的轻量级解决方案

基于docker-registry更加轻量级并自带可视化界面

 

  

 

 

  

posted on 2022-10-19 16:15  属于我的梦,明明还在  阅读(80)  评论(0)    收藏  举报