因为要迁移服务,我重新搭建了一套环境,然后想在搭建的本地镜像库里把需要的服务pull下来,结果出现了配置文件不生效的问题,具体如下:
root@ubuntu:~#vim/etc/default/docker DOCKER_OPTS="-H0.0.0.0:2375--insecure-registry192.168.10.249:5000" root@ubuntu:~#
重启:
root@ubuntu:~#/etc/init.d/dockerrestart [ok]Restartingdocker(viasystemctl):docker.service. root@ubuntu:~#
查看服务:
root@ubuntu:~#ps-ef|grepdocker root77691414:46?00:00:00/usr/bin/dockerd-Hfd:// root77767769014:46?00:00:00docker-containerd-lunix:///var/run/docker/libcontainerd/docker-containerd.sock--metrics-interval=0--start-timeout2m--state-dir/var/run/docker/libcontainerd/containerd--shimdocker-containerd-shim--runtimedocker-runc root78894143014:47pts/000:00:00grep--color=autodocker root@ubuntu:~#
root@ubuntu:~#mkdir-p/etc/systemd/system/docker.service.d root@ubuntu:~#cat/etc/systemd/system/docker.service.d/Using_Environment_File.conf [Service] EnvironmentFile=-/etc/default/docker ExecStart= ExecStart=/usr/bin/dockerdaemon-Hfd://$DOCKER_OPTS root@ubuntu:~# root@ubuntu:~#systemctldaemon-reload root@ubuntu:~#servicedockerrestart root@ubuntu:~#ps-ef|grep[d]ocker root79691214:58?00:00:00dockerd-Hfd://-H0.0.0.0:2375--insecure-registry192.168.10.249:5000 root79827969014:58?00:00:00docker-containerd-lunix:///var/run/docker/libcontainerd/docker-containerd.sock--metrics-interval=0--start-timeout2m--state-dir/var/run/docker/libcontainerd/containerd--shimdocker-containerd-shim--runtimedocker-runc root@ubuntu:~#
可以看到添加的那一句已经生效了。
如果觉得此文档帮助到了你,请点赞评论一下,谢谢!
原文链接:https://www.f2er.com/ubuntu/353945.html