赞
踩
参考
centos7搭建docker本地regsitry
官方英文文档
私有创建服务器系统是CentOS7系统。
注意,以非安全模式(insecure)启动后,启动后只能以http协议访问。
打开docker配置文件vi /etc/sysconfig/docker
,增加--insecure-registry=192.168.3.36:5000
结果如下:
# /etc/sysconfig/docker # Modify these options if you want to change the way the docker daemon runs OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --insecure-registry=192.168.3.36:5000' if [ -z "${DOCKER_CERT_PATH}" ]; then DOCKER_CERT_PATH=/etc/docker fi # Do not add registries in this file anymore. Use /etc/containers/registries.conf # instead. For more information reference the registries.conf(5) man page. # Location used for temporary files, such as those created by # docker load and build operations. Default is /var/lib/docker/tmp # Can be overriden by setting the following environment variable. # DOCKER_TMPDIR=/var/tmp # Controls the /etc/cron.daily/docker-logrotate cron job status. # To disable, uncomment the line below. # LOGROTATE=false # docker-latest daemon can be used by starting the docker-latest unitfile. # To use docker-latest client, uncomment below lines #DOCKERBINARY=/usr/bin/docker-latest #DOCKERDBINARY=/usr/bin/dockerd-latest #DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest #DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest
systemctl restart docker.service
//创建并启动容器
docker run -p 5000:5000 --name registry -v /home/chenyuan/docker/registry/volumes:/var/lib/registry --privileged=true --restart=always -d registry
docker pull tomcat
//给镜像一个别名。注意别名格式
docker tag tomcat localhost:5000/cy/tomcat
访问http://192.168.3.36:5000/v2/_catalog
(ip换成你自己的私有仓库地址)结果如下:
{"repositories":["cy/tomcat"]}
说明安装成功了
客户端是windows系统
我的windows客户器上打开C:\ProgramData\Docker\config
,增加配置"insecure-registries": [ "192.168.3.36:5000" ]
。结果如下
{ "insecure-registries": [ "192.168.3.36:5000" ], "debug": true, "experimental": true}
摘取镜像
docker pull 192.168.3.36:5000/cy/tomcat
注意,192.168.3.36:5000
是仓库注册服务器地址,cy/tomcat
是仓库名。
注册服务器是存放仓库的具体服务器,每个服务器上可以有多个仓库,每个仓库下有多个镜像。
结果如下
PS C:\WINDOWS\system32> docker pull 192.168.3.36:5000/cy/tomcat
Using default tag: latest
latest: Pulling from cy/tomcat
Digest: sha256:37b0c72d0d030839e0974ed3e803f2b65a1cf2403d2b2ca1083f096ae2dc57cc
Status: Image is up to date for 192.168.3.36:5000/cy/tomcat:latest
说明成功了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。