赞
踩
使用目前最新版Docker13.1搭建私有镜像仓库
安装最新版Docker sudo yum install -y docker
$ sudo docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-63.git94f4240.el7.centos.x86_64
Go version: go1.9.4
Git commit: 94f4240/1.13.1
Built: Fri May 18 15:44:33 2018
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-63.git94f4240.el7.centos.x86_64
Go version: go1.9.4
Git commit: 94f4240/1.13.1
Built: Fri May 18 15:44:33 2018
OS/Arch: linux/amd64
Experimental: false
docker pull docker.io/registry
修改配置文件 sudo vi /etc/sysconfig/docker
OPTIONS=’–selinux-enabled –log-driver=journald –signature-verification=false –insecure-registry 127.0.0.1:5000‘加粗地方是要加入的,是需要加入认证许可。
sudo mkdir /usr/local/src/docker_image_repo
sudo docker run -d -p 5000:5000 --name registry-local -v /usr/local/src/docker_image_repo:/tmp/registry docker.io/registry
/tmp/registry
指向容器外部路径/usr/local/src/docker_image_repo
sudo docker images
得到镜像列表$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
learn/ping latest f4c5a1866235 4 hours ago 140 MB
docker.io/hello-world latest e38bc07ac18e 2 months ago 1.85 kB
docker.io/registry latest d1fd7d86a825 5 months ago 33.3 MB
docker.io/learn/tutorial latest a7876479f1aa 5 years ago 128 MB
docker tag docker.io/registry:latest 127.0.0.1:5000/registry
只能将tag标签设置为127.0.0.1:5000的镜像上传到私有镜像库,上传命令:
sudo docker push 127.0.0.1:5000/registry
$ curl -XGET http://127.0.0.1:5000/v2/_catalog
{"repositories":["hello-world","learn/ping","registry"]}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。