docker 创建本地私有仓库

docker 创建本地私有仓库


环境Win10专业版,默认安装Windows版Docker

1.pull仓库镜像

docker pull regitry

2.启动仓库镜像

docker run -d -p 5000:5000  --restart=always --name registry  registry 

3.上传镜像到私有仓库

docker tag hello 127.0.0.1:5000/hello-world (先将镜像打上标签)
 docker push 127.0.0.1:5000/hello-world (将镜像推送到本地仓库)

私有镜像默认仓库位置在 /var/lib/docker/volumes/ 下。

本机通过http://localhost:5000/v2/_catalog可查看已上传的镜像

4.其他电脑pull私有仓库
因为本地没有https,只能通过http访问,但是V2的仓库默认只支持https,其他电脑的docker需要修改daemon.json配置中的insecure-registries属性, Linux上配置文件的默认位置是 /etc/docker/daemon.json

{
  "registry-mirrors": [
    "https://registry.docker-cn.com"
  ],
  "insecure-registries": [
    "IP:5000"
  ]
}
insecure-registries": ["IP:5000"]  //这里的IP就是你本地的ip

重启服务

sudo systemctl daemon-reload
sudo systemctl restart docker

然后参考第三步进行pull,但注意 IP要改成本地IP,不是127.0.0.1

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值