10

docker学习笔记–docker搭建官方版私有仓库(了解) |坐而言不如起而行! 二丫讲梵

 3 years ago
source link: http://www.eryajf.net/1939.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
本文预计阅读时间 6 分钟

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

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

2,通过配置,连接私服。

  1. vim /etc/docker/daemon.json
  2. "insecure-registries": ["192.168.106.5:5000"]
  3. systemctl restart docker

3,验证推拉镜像。

  1. [root@localhost ~]$docker tag docker.io/ruibaby/halo 192.168.106.5:5000/halo
  2. [root@localhost ~]$docker push 192.168.106.5:5000/halo
  3. The push refers to a repository [192.168.106.5:5000/halo]
  4. 235396e2e49d: Pushed
  5. e3da0e1554b0: Pushed
  6. 5b2393b02905: Pushed
  7. 3344e993faf9: Pushed
  8. f146389833a6: Pushed
  9. bc291d65c8e7: Pushed
  10. 8b47d19735d5: Pushed
  11. e9805f9bdc9e: Pushed
  12. 9c147c576d67: Pushed
  13. 685f72a7cd4f: Pushed
  14. 097524d80f54: Pushed
  15. 1191b3f5862a: Pushed
  16. 08a01612ffca: Pushed
  17. 8bb25f9cdc41: Pushed
  18. f715ed19c28b: Pushed
  19. latest: digest: sha256:b14708cdecd988f1da7a6a6c988d58cc4bbf4359e1772901e103c3e42b77ba35 size: 3467

4,查看仓库里的镜像。

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

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

71cfeb93ly1gmaw06w2bjj20jf06omyq.jpg

5,在其他主机测试。

先配置连接。

  1. vim /etc/docker/daemon.json
  2. "insecure-registries": ["192.168.106.5:5000"]
  3. systemctl restart docker

然后测试一下拉镜像。

  1. [root@localhost ~]$docker pull 192.168.106.5:5000/halo
  2. Using default tag: latest
  3. Trying to pull repository 192.168.106.5:5000/halo ...
  4. latest: Pulling from 192.168.106.5:5000/halo
  5. bc9ab73e5b14: Pull complete
  6. 193a6306c92a: Pull complete
  7. e5c3f8c317dc: Pull complete
  8. a587a86c9dcb: Pull complete
  9. a4c7ee7ef122: Pull complete
  10. a7c0dad691e9: Pull complete
  11. 367a6a68b113: Pull complete
  12. 28351dec2f89: Pull complete
  13. bfa52db486a3: Pull complete
  14. 486c2b19fa61: Pull complete
  15. 4347d45f20ca: Pull complete
  16. 5f40f4dee7fa: Pull complete
  17. b4fb2907506a: Pull complete
  18. 4ce77557a36f: Pull complete
  19. 3f42e1292556: Pull complete
  20. Digest: sha256:b14708cdecd988f1da7a6a6c988d58cc4bbf4359e1772901e103c3e42b77ba35
  21. Status: Downloaded newer image for 192.168.106.5:5000/halo:latest
  22. [root@localhost ~]$docker images
  23. REPOSITORY TAG IMAGE ID CREATED SIZE
  24. 192.168.106.5:5000/halo latest f1bf61fa7d73 8 days ago 721 MB

weinxin


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK