centos6.5, docker 1.7.1
vi /etc/sysconfig/docker
#修改
other_args="--insecure-registry 192.168.1.110:5000"
#重启服务
service docker restart
centos7.2,docker 1.9.1;
vi /usr/lib/systemd/system/docker.service
#修改
ExecStart=/usr/bin/docker daemon -H fd:// --insecure-registry 192.168.1.110:5000
#重启服务
systemctl daemon-reload
systemctl restart docker.service
备注:
不同版本的centos,ExecStart可能不同.
比如: vim /usr/lib/systemd/system/docker
.service
[Service]
Type=notify
NotifyAccess=all
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
ExecStart=/bin/sh -c '/usr/bin/docker daemon $OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
2>&1 | /usr/bin/forward-journald -tag docker'
这时候就需要修改环境变量/etc/sysconfig/docker
具体请自行检查.
检查docker启动是否正常
[root@centos7 default]# ps -ef | grep docker
root 110806 1 5 17:17 ? 00:00:39 /usr/bin/docker daemon -H fd:// --insecure-registry 10.7.137.1:5000
如果你能看到加粗的说明你的服务启动正常.
去掉了https,启用了http
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
如果启动参数没有带--insecure-registry 10.7.137.1:5000,push会提示
[root@centos7_2 sysconfig]# docker push 10.7.137.1:5000/centos-slave
The push refers to a repository [10.7.137.1:5000/centos-slave] (len: 1)
unable to ping registry endpoint https://10.7.137.1:5000/v0/
v2 ping attempt failed with error: Get https://10.7.137.1:5000/v2/: EOF
v1 ping attempt failed with error: Get https://10.7.137.1:5000/v1/_ping: EOF
注意里面的是https.
作为client去registry上pull images的话.
同样也需要修改docker启动的方式,需要指定私服ip方式.