您的位置:首页 > 其它

仓库管理

2016-06-12 14:01 183 查看
仓库管理
docker pull registry //下载registry 镜像,registy为docker官方提供的一个镜像,我们可以用它来创建本地的docker私有仓库。
docker run -d -p 5000:5000 registry //以registry镜像启动容器,监听5000端口
curl 127.0.0.1:5000 //可以访问它

下面我们来把其中一个镜像上传到私有仓库
1. docker tag aming_test 172.7.15.106:5000/centos //标记一下tag,必须要带有私有仓库的ip:port
2. docker push 172.7.15.106:5000/centos //此时报错了类似如下
Error response from daemon: invalid registry endpoint https://172.7.15.106:5000/v0/: unable to ping registry endpoint https://172.7.15.106:5000/v0/ v2 ping attempt failed with error: Get https://172.7.15.106:5000/v2/: EOF
v1 ping attempt failed with error: Get https://172.7.15.106:5000/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry 172.7.15.106:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/172.7.15.106:5000/ca.crt

这是因为Docker从1.3.X之后,与docker registry交互默认使用的是https,然而此处搭建的私有仓库只提供http服务,所以当与私有仓库交互时就会报上面的错误。为了解决这个问题需要在启动docker server时增加启动参数为默认使用http访问。解决该问题的方法为:

vi /etc/init.d/docker

把 $exec -d $other_args 改为
$exec -d --insecure-registry 172.7.15.106:5000 $other_args

然后重启docker
service docker restart
再启动registry容器
docker start registry_container_id

curl http://172.7.15.106:5000/v1/search //可以查看私有仓库里面的所有镜像
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: