docker学习笔记之私有仓库搭建

1.下载私有镜像库

docker  pull registry

2.运行容器

docker run -itd -p 5000:5000 -v /data/registry:/var/lib/registry --restart=always --name registry registry:latest

3. 生成本地hello-world的镜像

docker tag hello-world 192.168.1.179:5000/hello-world:v1

 

 4.推送本地hello-world镜像到私有仓库

 docker push 192.168.1.179:5000/hello-world:v1

 报错误:

docker push 192.168.1.179:5000/hello-world:v1
The push refers to repository [192.168.1.179:5000/hello-world]
Get https://192.168.1.179:5000/v2/: http: server gave HTTP response to HTTPS client、

默认是需要https,所以推送失败。

配置私有仓库不需要https:

 /etc/docker/daemon.json 
{
  "registry-mirror": [
    "https://registry.docker-cn.com"
  ],
  "insecure-registries": [
    "192.168.1.157:5000"
  ]
}

文件如果不存在就新建。

 

重启docker服务且再次推送:

systemctl restart docker

docker push 192.168.1.179:5000/hello-world:v1

 

5. 查看私有仓库

- 查看仓库列表

http://192.168.1.179:5000/v2/_catalog

- 查看指定仓库的版本列表

http://192.168.1.179:5000/v2/hello-world/tags/list

 

6.测试

可以删除本地 192.168.1.179:5000/hello-world:v1 镜像,从私有库拉取,也可以在从其它服务器测试。

 

至此本地私有仓库已经搭建完成

 

转载于:https://www.cnblogs.com/zqsb/p/10388525.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值