私有Docker Rigistry的搭建问题

 

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

首先,在服务器上安装docker

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

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

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

#apt-get install -y curl服务器

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

 

其次,安装docker registry镜像

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

#mkdir -p /opt/data/registryurl

#cd docker-registryspa

#docker buildip

 

建立好镜像后,运行镜像

#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"}]}

 

 

上面的步骤只实现了在本地上传镜像,若是须要在其余机器上上传镜像,可能还须要其余的步骤。

相关文章
相关标签/搜索