dockr 配置文件修改_Ubuntu 16.04下Docker修改配置文件不生效解决办法

因为要迁移服务,我重新搭建了一套Ubuntu 16.04环境,然后想在搭建的本地镜像库里把需要的服务pull下来,结果出现了配置文件不生效的问题,具体如下:

配置文件添加:

root@ubuntu:~# vim /etc/default/docker

DOCKER_OPTS="-H 0.0.0.0:2375 --insecure-registry 192.168.10.249:5000"

root@ubuntu:~#

重启:

root@ubuntu:~# /etc/init.d/docker restart

[ ok ] Restarting docker (via systemctl): docker.service.

root@ubuntu:~#

查看服务:

root@ubuntu:~# ps -ef|grep docker

root      7769    1  4 14:46 ?        00:00:00 /usr/bin/dockerd -H fd://

root      7776  7769  0 14:46 ?        00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc

root      7889  4143  0 14:47 pts/0    00:00:00 grep --color=auto docker

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/docker daemon -H fd:// $DOCKER_OPTS

root@ubuntu:~#

root@ubuntu:~# systemctl daemon-reload

root@ubuntu:~# service docker restart

root@ubuntu:~# ps -ef|grep [d]ocker

root      7969    1  2 14:58 ?        00:00:00 dockerd -H fd:// -H 0.0.0.0:2375 --insecure-registry 192.168.10.249:5000

root      7982  7969  0 14:58 ?        00:00:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc

root@ubuntu:~#

可以看到添加的那一句已经生效了。

更多Docker相关教程见以下内容:

Docker 的详细介绍:请点这里

Docker 的下载地址:请点这里

0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值