Registry搭建docker私仓

Docker Registry

Docker Registry是官方提供的工具,用于构建私有镜像仓库。

环境搭建

Docker Registry也是Docker Hub提供的一个镜像,可以直接拉取运行。

步骤:

  1. 拉取镜像
docker pull registry
  1. 启动Docker Registry
docker run -d -p 5000:5000 -v /app/myregistry/:/tmp/registry --privileged=true registry

  1. 验证(查看私服中的所有镜像)
curl http://172.50.30.100:5000/v2/_catalog


Registry会返回json格式的所有镜像目录

向Registry私仓中上传镜像

将镜像修改为符合规范的Tag

[root@localhost ~]# docker tag ubuntu/ifconfig:1.2  172.50.30.100:5000/ubuntu/ifconfig:1.2 

配置docker允许接收http请求

docker默认不允许http方式推送镜像

修改/etc/docker/daemon.json,添加insecure-registries允许http:

{
    "registry-mirros": ["https://xxxx.mirror.aliyuncs.com"], #注意这里要写个逗号
    "insecure-registries": ["192.168.xxx.xxx:5000"] #添加使其解除限制
}

如果配置不生效,建议重启docker

推送镜像到本地私仓

1.push到私仓 :

[root@localhost ~]# docker push 172.50.30.100:5000/ubuntu/ifconfig:1.2 
The push refers to repository [172.50.30.100:5000/ubuntu/ifconfig]
af9216e52108: Pushed 
9f54eef41275: Pushed 
1.2: digest: sha256:1d3a02eb0a82c370bfc8c42104b7a02985d0bebf7ceccd22ce4ba3013831160b size: 74.1

2.拉取验证:

[root@localhost ~]# docker pull  172.50.30.100:5000/ubuntu/ifconfig:1.2
1.2: Pulling from ubuntu/ifconfig
Digest: sha256:1d3a02eb0a82c370bfc8c42104b7a02985d0bebf7ceccd22ce4ba3013831160b
Status: Downloaded newer image for 172.50.30.100:5000/ubuntu/ifconfig:1.2
172.50.30.100:5000/ubuntu/ifconfig:1.2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值