博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
docker 创建本地registry并push镜像
阅读量:4286 次
发布时间:2019-05-27

本文共 1845 字,大约阅读时间需要 6 分钟。

在本地上创建registry:

# docker run -d -p 5000:5000 -v /opt/ata/registry:/var/lib/registry registryUnable to find image 'registry:latest' locallyTrying to pull repository docker.io/library/registry ... latest: Pulling from docker.io/library/registry79650cf9cc01: Pull complete 70ce42745103: Pull complete 77edd1a7fa4d: Pull complete 432773976ace: Pull complete 3234a47fe5a9: Pull complete Digest: sha256:a3551c422521617e86927c3ff57e05edf086f1648f4d8524633216ca363d06c267d71842f18dd3678232dbd571753543144ac4a10931e658762023e73a270077[root@localhost Desktop]# docker imagesREPOSITORY           TAG                 IMAGE ID            CREATED             SIZEtest                 latest              3ab5471af4a3        3 hours ago         117.9 MBubuntu               latest              ebcd9d4fca80        15 hours ago        117.9 MBdocker.io/registry   latest              9d0c4eabab4d        5 days ago          33.17 MB

如果在本地上没有registry镜像,将会到docker hub上拉取。这条命令将映射5000端口给registry用,并将仓库镜像存储目录/var/lib/registry/挂到本地/opt/data/registry/下

# netstat -nlpt | grep 5000tcp6       0      0 :::5000                 :::*                    LISTEN      58433/docker-proxy-
修改镜像标签:

# docker tag test:latest 192.168.163.131:5000/test
push镜像到本地registry:

# docker push 192.168.163.131:5000/testThe push refers to a repository [192.168.163.131:5000/test]9ec45e5f0334: Pushed 33f1a94ed7fc: Pushed b27287a6dbce: Pushed 47c2386f248c: Pushed 2be95f0d8a0c: Pushed 2df9b8def18a: Pushed latest: digest: sha256:d9ab970410b33851a7d9a9b84055348a1d5ec27926f5b5fbd0f214c9f710f10c size: 1564

查看镜像:

[root@localhost repositories]# cd /opt/data/registry/docker/registry/v2/repositories[root@localhost repositories]# lstest[root@localhost repositories]#
也可以通过http的形式来查看registry中的镜像:

[root@localhost repositories]# curl http://192.168.163.131:5000/v2/_catalog{"repositories":["test"]}

转载地址:http://fcxgi.baihongyu.com/

你可能感兴趣的文章
iOS 内存分区和关于static的使用
查看>>
iOS中代码性能测试的方法
查看>>
iOS 之系统的autoLayou自动t布局
查看>>
iOS UIDatePicker的使用(一)
查看>>
iOS corefoundation与foundation的桥接问题
查看>>
iOS 修改状态栏样式
查看>>
iOS 中关于绘图的框架介绍、手势解锁
查看>>
iOS 手势绘图/小画板的实现
查看>>
iOS 绘图Quartz2D的内存管理
查看>>
iOS 绘图Quartz2DQ绘制图片和文字
查看>>
iOS 绘图Quartz2d图片裁剪/加水印/截屏
查看>>
iOS touch事件的多点触控案例和获取touch的属性
查看>>
iOS ARC内存管理/strong weak copy assign 的用法与区别(一)
查看>>
iOS NSthread多线程的应用原理与总结
查看>>
iOS GCD多线程的使用
查看>>
iOS NSOperation多线程的使用与理解
查看>>
iOS之屏幕旋转调用的方法
查看>>
iOS之中打电话/发短息/发邮件/吊起QQ聊天的方法总结
查看>>
iOS之UIImageView和UIImage
查看>>
iOS OC原生的输入输出流结合socket实现即时通讯
查看>>