搭建Docker本地 Registry

官方教程 Deploy a registry server | Docker Documentation

Docker Hub 虽然非常方便,但还是有些限制,比如:

  1. 需要 internet 连接,而且下载和上传速度慢。

  2. 上传到 Docker Hub 的镜像任何人都能够访问,虽然可以用私有 repository,但不是免费的。

  3. 安全原因很多组织不允许将镜像放到外网。


一、Run a local registry

第一步:启动 registry 容器;

 docker run -d -p 5000:5000 -v /myregistry:/var/lib/registry --name registry registry:2

 

第二步:通过 docker tag 重命名镜像,使之与 registry 匹配

以centos为例,

docker pull centos

docker tag centos:latest localhost:5000/my-centos

第三步:Push the image to the local registry running at localhost:5000:

docker push localhost:5000/my-centos

第四步:Remove the locally-cached centos:latest and localhost:5000/my-centos images, so that you can test pulling the image from your registry

docker image remove localhost:5000/my-centos
docker image remove centos:latest

第五步:Pull the localhost:5000/my-centos image from your local registry

docker pull localhost:5000/my-centos

二、Stop a local registry

docker container stop registry

To remove the container, use docker container rm.:

docker container stop registry && docker container rm -v registry

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值