docker-搭建docker镜像私服

一、本地搭建

1、拉取registry

docker pull registry

2、运行容器

docker run -d -p 5000:5000 --restart=always --name registry -v /opt/registry:/var/lib/registry registry

image-20200129160007306

访问http://localhost:5000/v2/_catalog

image-20200129160534572

3、上传镜像

①查看已有镜像

docker images

$$

$$

image-20200129160418993

②给要上传的镜像打标签

docker tag redis:latest localhost:5000/redis:t1

③推送镜像

docker push localhost:5000/redis:t1

image-20200129163027637

浏览http://localhost:5000/v2/_catalog

http://localhost:5000/v2/redis/tags/list

image-20200129162818908

④拉取镜像

先删除本地镜像

docker rmi localhost:5000/redis:t1
docker pull localhost:5000/redis:t1

image-20200129172639080

原文地址:https://www.cnblogs.com/roluodev/p/12251479.html