See this issue.
Docker best practise to Control and configure Docker with systemd.
-
Create
daemon.json
file in/etc/docker
:{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
-
Add
/etc/systemd/system/docker.service.d/override.conf
[Service] ExecStart= ExecStart=/usr/bin/dockerd
-
Reload the systemd daemon:
systemctl daemon-reload
-
Restart docker:
systemctl restart docker.service
This something I've tried as well and ran in to a few issues creating
/etc/systemd/system/docker.service.d/override.conf
, I am running Debian 10 and installed (and updated) docker using the script provided in the documentation. (Install using the convenience script)After reloading the systemd daemon docker still failed to start, going to the log I noticed the following line: (getting the last few lines of the log
sudo tail -n 100 /var/log/daemon.log
To get this to work I adding hosts to
/etc/docker/daemon.json
and editing/lib/systemd/system/docker.service
(runningsudo systemctl status docker.service
reported the daemon being loaded from there) where I removed host provided in the start:After which reloading the systemd daemon and restarting docker worked as a charm.