client端要配置docker -d --insecure-registry myhost:5000 类似这样的参数,这样的语句直接跑是可以的,但我们需要把配置信息加入到启动service中,这样才能在后头配置好,阿里云加速器也是这个道理。
参考了https://github.com/docker/docker-registry/issues/1005 中 dotNetDR的解决方法,在docker.service中加入环境变量文件,再修改启动信息,编辑环境变量文件。再restart就可以啦。
file: /lib/systemd/system/docker.service text:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
EnvironmentFile=-/etc/sysconfig/docker
ExecStart=/usr/bin/docker -d $other_args -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
check here >> EnvironmentFile=-/etc/sysconfig/docker
check here >> ExecStart=/usr/bin/docker -d $other_args -H fd://
file: /etc/sysconfig/docker text:
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d
other_args="--insecure-registry yoururl"