docker搭建官方版私有仓库

1,直接通过如下命令启动私有仓库

docker run -d --name registry -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always registry

2,通过配置,连接私服

vim /etc/docker/daemon.json
{
    "insecure-registries": ["192.168.106.5:5000"]
}
 
systemctl restart docker

3,验证推拉镜像

[root@localhost ~]$docker tag docker.io/ruibaby/halo 192.168.106.5:5000/halo
 
[root@localhost ~]$docker push 192.168.106.5:5000/halo
The push refers to a repository [192.168.106.5:5000/halo]
235396e2e49d: Pushed
e3da0e1554b0: Pushed
5b2393b02905: Pushed
3344e993faf9: Pushed
f146389833a6: Pushed
bc291d65c8e7: Pushed
8b47d19735d5: Pushed
e9805f9bdc9e: Pushed
9c147c576d67: Pushed
685f72a7cd4f: Pushed
097524d80f54: Pushed
1191b3f5862a: Pushed
08a01612ffca: Pushed
8bb25f9cdc41: Pushed
f715ed19c28b: Pushed
latest: digest: sha256:b14708cdecd988f1da7a6a6c988d58cc4bbf4359e1772901e103c3e42b77ba35 size: 3467

4,查看仓库里的镜像

[root@localhost ~]$curl -XGET http://192.168.106.5:5000/v2/_catalog
{"repositories":["halo"]}

也可以在浏览器当中进行查看:

5,在其他主机测试

先配置连接。

vim /etc/docker/daemon.json
{
    "insecure-registries": ["192.168.106.5:5000"]
}
 
systemctl restart docker

然后测试一下拉镜像。

[root@localhost ~]$docker pull 192.168.106.5:5000/halo
Using default tag: latest
Trying to pull repository 192.168.106.5:5000/halo ...
latest: Pulling from 192.168.106.5:5000/halo
bc9ab73e5b14: Pull complete
193a6306c92a: Pull complete
e5c3f8c317dc: Pull complete
a587a86c9dcb: Pull complete
a4c7ee7ef122: Pull complete
a7c0dad691e9: Pull complete
367a6a68b113: Pull complete
28351dec2f89: Pull complete
bfa52db486a3: Pull complete
486c2b19fa61: Pull complete
4347d45f20ca: Pull complete
5f40f4dee7fa: Pull complete
b4fb2907506a: Pull complete
4ce77557a36f: Pull complete
3f42e1292556: Pull complete
Digest: sha256:b14708cdecd988f1da7a6a6c988d58cc4bbf4359e1772901e103c3e42b77ba35
Status: Downloaded newer image for 192.168.106.5:5000/halo:latest
[root@localhost ~]$docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
192.168.106.5:5000/halo   latest              f1bf61fa7d73        8 days ago          721 MB

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CN-FuWei

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值