10
docker学习笔记–docker搭建官方版私有仓库(了解) |坐而言不如起而行! 二丫讲梵
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.
本文预计阅读时间 6 分钟
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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK