下载registry镜像
[root@ztydl ~]# docker pull registry
latest: Pulling from registry
34c9deb8b2e3: Pulling fs layer
b24f937674dc: Pulling fs layer
d6ab9040277b: Pulling fs layer
ca9314dabb86: Pulling fs layer
0ba8ddb3599a: Pulling fs layer
ad3a85b053aa: Pulling fs layer
374f67927372: Pulling fs layer
27759ef3562c: Pulling fs layer
af0a7316d4d4: Pulling fs layer
Digest: sha256:1e0f05a52a7540855d6ce606d1bdff6a82ff5c36ff62e7d44006ec7705ecc80e
Status: Downloaded newer image for registry:latest
使用该镜像启动一个容器
[root@ztydl ~]# docker run -d -p 5000:5000 registry
1fe7618d05e4c5324322ff20314032c6e0746b380c86d5e5503aadfde3c63929
修改将要push的镜像的tag
[root@ztydl ~]# docker tag centos 127.0.0.1:5000/zty-centos
将修改过tag的镜像push到本地仓库中去
[root@ztydl ~]# docker push 127.0.0.1:5000/zty-centos
The push refers to a repository [127.0.0.1:5000/zty-centos] (len: 1)
1c1b67b33c28: Image already exists
1c1b67b33c28: Buffering to Disk
6c5159923047: Image successfully pushed
Digest: sha256:f8544b05eee55a72a3507c3a409395f89f2472e7d7f60ab55c2585c068a3c9ed
push成功,查询私有仓库有哪些镜像
[root@ztydl ~]# curl 192.168.70.131:5000/v2/_catalog
{"repositories":["zty-centos"]}