Since 16.04 release Ubuntu stopped using Upstart and switch to Systemd for its init system.
How can I change default DOCKER_OPTS parameters?
Execute following commands as root (or with sudo).
To extend the default docker unit file with additional configuration options, first create a configuration directory in /etc/systemd/system/
:
mkdir /etc/systemd/system/docker.service.d/
Now put a configuration file in /etc/systemd/system/docker.service.d/
. It's imperative that the file name must end with the .conf
suffix:
touch /etc/systemd/system/docker.service.d/docker.conf
To change daemon parameters create configuration file with following content (ex. adds --dns
option):
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --dns 8.8.8.8
After saving docker unit file, before systemd will take it into account, systemd needs to reload modified data:
systemctl daemon-reload
Finally docker service can be restarted:
systemctl restart docker
You can check that status by running:
systemctl status docker.service | grep dns
On Ubuntu default configuration is located in /lib/systemd/system/docker.service
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With