centos6.5, docker 1.7.1
docker
vi /etc/sysconfig/dockervim
#修改centos
other_args="--insecure-registry 192.168.1.110:5000"centos7
#重啓服務spa
service docker restartrest
centos7.2,docker 1.9.1;code
vi /usr/lib/systemd/system/docker.serviceip
#修改it
ExecStart=/usr/bin/docker daemon -H fd:// --insecure-registry 192.168.1.110:5000stream
#重啓服務
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方式.