/etc/sysconfig/docker # /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 myhost:5000"
[root@docker05 bin]# docker search myhost:5000/xxx Error response from daemon: invalid registry endpoint https://myhost:5000/v0/: unable to ping registry endpoint https://myhost:5000/v0/ v2 ping attempt failed with error: Get https://myhost:5000/v2/: tls: oversized record received with length 20527 v1 ping attempt failed with error: Get https://myhost:5000/v1/_ping: tls: oversized record received with length 20527. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry myhost:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/myhost:5000/ca.crt
[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要加EnvironmentFile=-/etc/sysconfig/docker和编辑ExecStart=/usr/bin/docker -d $other_args -H fd://收起
centos7 上 需要做如下配置:
vim /lib/systemd/system/docker.service
增加 EnvironmentFile=/etc/sysconfig/docker
然后执行 systemctl reload 然后 other_args 就生效了。
还有啊。配置的参数生效不生效。简单的 ps -ef |grep docker 进程就可以看出来。不需要那么麻烦。
收起