私有Docker Rigistry的搭建问题

 

开发中如果使用docker镜像,因为网速问题,使用dockerhub不是很方便,于是想在公司内部搭建私有的Registry。

首先,在服务器上安装docker

如果使用apt-get install docker安装ubuntu自带的docker,可能版本比较低,这样有可能在docker pull时会遇到:

Could not reach any registry endpoint 这样的错误。

解决方案就是安装docker提供的版本:

#apt-get install -y curl

#curl -sSL https://get.docker.com/ | sudo sh

 

其次,安装docker registry镜像

#git clone https://github.com/docker/docker-registry.git

#mkdir -p /opt/data/registry

#cd docker-registry

#docker build

 

创建好镜像后,运行镜像

#docker run -d -e SETTINGS_FLAVOR=dev -e STORAGE_PATH=/tmp/registry -v /opt/data/registry:/tmp/registry  -p 5000:5000 registry

 

 

这样,私有registry就搭建好了,可以向上面传输镜像了

#docker push 127.0.0.1:5000/ubuntu:12.04

报错:

The push refers to a repository [127.0.0.1:5000/utuntu] (len: 1)
Repository does not exist: 127.0.0.1:5000/utuntu

执行 

#docker tag ubuntu:12.04 127.0.0.1:5000/ubuntu:12.04

再上传

#docker push 127.0.0.1:5000/ubuntu:12.04,上传成功。

通过命令:

#curl -X GET http://127.0.0.1:5000/v1/search

查看Registry上的镜像,返回:

{"num_results": 1, "query": "", "results": [{"description": "", "name": "library/ubuntu"}]}

 

 

上面的步骤只实现了在本地上传镜像,如果需要在其他机器上上传镜像,可能还需要其他的步骤。

 

 

转载于:https://www.cnblogs.com/coldsword/p/5368567.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值