docker 创建自己的镜像仓库

:/home/yindongzi# docker run -d -p 5001:5000 -v /usr/local/registry:/var/lib/registry --restart=always --name registry registry:2
97469284c8d735919f78e225c1c78a8d8aa714fa878c308e03e40d4fdacc0d03

:/home/yindongzi# curl http://localhost:5001/v2/_catalog
{"repositories":[]}

:/home/yindongzi# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
bdbbaa22dec6: Pull complete
Digest: sha256:6915be4043561d64e0ab0f8f098dc2ac48e077fe23f488ac24b665166898115a
Status: Downloaded newer image for busybox:latest
docker.io/library/busybox:latest:/home/yindongzi# docker images|grep busybox
busybox                     latest              6d5fcfe5ff17        7 weeks ago         1.22MB
#名称一定要修改掉,不然直接push是不成功的:/home/yindongzi# docker tag busybox localhost:5001/busybox:v1.0:/home/yindongzi# docker images|grep busybox
busybox                     latest              6d5fcfe5ff17        7 weeks ago         1.22MB
localhost:5001/busybox      v1.0                6d5fcfe5ff17        7 weeks ago         1.22MB
:/home/yindongzi# docker push localhost:5001/busybox
The push refers to repository [localhost:5001/busybox]
195be5f8be1d: Pushed

v1.0: digest: sha256:edafc0a0fb057813850d1ba44014914ca02d671ae247107ca70c94db686e7de6 size: 527
:/home/yindongzi# curl http://localhost:5001/v2/_catalog
{"repositories":["busybox"]}

以上内容是将本地的仓库push到localhost:5001的registry,如果是push到目标IP,给不同的人push/pull,可以参考https://www.cnblogs.com/jpfss/p/10948256.html

相关推荐