Docker的私有仓库
server 192.168.1.107 registry ---push
client 192.168.1.103 --pull
【192.168.1.107上操作】
docker pull docker.io/registry
docker pull nginx
启动私有仓库
docker run -d -p 5000:5000 --name registry registry
对nginx 打标记
docker tag nginx 192.168.1.107:5000/nginx20160827:v1
siysiyopush 到私有仓库中
[root@etcd ~]# docker push 192.168.1.107:5000/nginx20160827:v1
The push refers to a repository [192.168.1.107:5000/mynginx] (len: 1)
unable to ping registry endpoint https://192.168.1.107:5000/v0/
v2 ping attempt failed with error: Get https://192.168.1.107:5000/v2/: tls: oversized record received with length 20527
v1 ping attempt failed with error: Get https://192.168.1.107:5000/v1/_ping: tls: oversized record received with length 20527
没有进行ca证书认证,跳过证书,添加: --insecure-registry 192.168.1.107:5000
[root@etcd ~]# vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
ExecStart=/usr/bin/docker daemon --registry-mirror=http://f71f084d.m.daocloud.io --insecure-registry 192.168.1.107:5000 -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
重启服务
[root@etcd ~]# systemctl daemon-reload
[root@etcd ~]# systemctl restart docker.service
【192.168.1.103上操作】
没有进行ca证书认证,跳过证书,添加: --insecure-registry 192.168.1.107:5000
[root@etcd ~]# vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
ExecStart=/usr/bin/docker daemon --registry-mirror=http://f71f084d.m.daocloud.io --insecure-registry 192.168.1.107:5000 -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
# docker tag nginx 192.168.1.107:5000/nginx20160827:v1 下载镜像
查看镜像:
[root@docker131 yum.repos.d]# docker images
192.168.1.107:5000/nginx20160827 v1 bfdd4ced794e 3 days ago 183.4 MB
启动一个容器
[root@docker131 yum.repos.d]# docker create --name nginx1 -h nginx1 192.168.1.107:5000/nginx20160827:v1
[root@docker131 yum.repos.d]# docker start nginx1
[root@docker131 yum.repos.d]# docker exec -it nginx1 /bin/bash