Docker建立本地Registry

从容器运行一个Registry

# docker run -p 5000:5000 registry 

查看yelinyuntest/static_web镜像

# docker images yelinyuntest/static_web 
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
yelinyuntest/static_web latest 384b4f26cc09 3 days ago 227.5 MB

为镜像打Tag

# docker tag -f 384b4f26cc09 localhost:5000/yelinyuntest/static_web 

 把镜像推送到本地Registry中

# docker push localhost:5000/yelinyuntest/static_web
The push refers to a repository [localhost:5000/yelinyuntest/static_web] (len: 1)
Sending image list
Pushing repository localhost:5000/yelinyuntest/static_web (1 tags)
Image 2fc17c1f5db4 already pushed, skipping
Image 143997bb556a already pushed, skipping
Image 7bc86777be5f already pushed, skipping
Image 08944432398f already pushed, skipping
Image 0bb1d07e4d6b already pushed, skipping
Image e2bc3ef3e1a3 already pushed, skipping
Image 1ee92674a984 already pushed, skipping
d384116a5993: Image successfully pushed 
f3388c62a27e: Image successfully pushed 
384b4f26cc09: Image successfully pushed 
Pushing tag for rev [384b4f26cc09] on {http://localhost:5000/v1/repositories/yelinyuntest/static_web/tags/latest}

然后可以用docker run 命令构建新容器

原文地址:https://www.cnblogs.com/sfnz/p/5670434.html