下载镜像仓库
[root@docker01 mysql]# docker pull registry
Using default tag: latest
latest: Pulling from library/registry
90f4dba627d6: Pull complete
Digest: sha256:0f8fe61fa337b8ef02217702ba979b47a7d68717d4628f31592ebff85915f3ba
Status: Downloaded newer image for registry:latest
[root@docker01 mysql]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest 28525f9a6e46 12 days ago 33.2MB
启动并且挂载镜像仓库到本地磁盘
[root@docker01 mysql]# docker run -d -p 5000:5000 -v /registry:/var/lib/registry registry
82b2384664e6f360e636f1fadf31ca3adf762906139a3c79ba73e67d0b157c0d
[root@docker01 mysql]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
82b2384664e6 registry "/entrypoint.sh /e..." 7 seconds ago Up 5 seconds 0.0.0.0:5000->5000/tcp clever_jang
给一个本地镜像打个标签然后上传
[root@docker01 mysql]# docker tag workpress/nginx:1.0 192.168.159.159:5000/nginx:1.1
[root@docker01 mysql]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry latest 28525f9a6e46 12 days ago 33.2MB
workpress/nginx 1.0 2fbed074486c 7 weeks ago 652MB
192.168.159.159:5000/nginx 1.1 2fbed074486c 7 weeks ago 652MB
直接上传到仓库
docker push 192.168.159.159:5000/nginx:1.1
查看挂载目录是否有镜像
[root@docker01 mysql]# ls /registry/
docker
关于本地镜像的查看
[root@docker01 mysql]# curl http://192.168.159.159:5000/v2/_catalog
{"repositories":["nginx"]}
有1个镜像,可以获取他的标签信息以便下载
[root@docker01 mysql]# curl http://192.168.159.159:5000/v2/nginx/tags/list
{"name":"nginx","tags":["1.1"]}
直接下载镜像
docker pull 192.168.159.159:5000/nginx:1.1
192.168.159.159:5000是仓库地址
docker -rmi 只能删除本地的,不能删除仓库里面的