1

Need to edit following entries:

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

in /lib/systemd/system/docker.service file


$ sudo -E systemctl edit docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 --containerd=/run/containerd/containerd.sock

did not update the service file after restart(sudo systemctl restart docker.service)


What is the recommended approach to edit service file(docker.service)?

  • Does systemctl daemon-reload help? What does systemctl cat docker show? And systemctl show docker? – Stephen Kitt Sep 18 '19 at 16:14
  • @StephenKitt No it doesn't but why systemctl restart doesn't? – overexchange Sep 18 '19 at 16:19
  • Just to baby-step it, the man page says that the updates are "written to the real location if the editor exits successfully.". I assume you exited your editor successfully? It does also say that "After the units have been edited, systemd configuration is reloaded (in a way that is equivalent to daemon-reload)." – Jeff Schaller Sep 18 '19 at 16:30
  • Another issue is, systemctl restart in EC2 requires passwd, which I don't know – overexchange Sep 18 '19 at 16:31
  • Let me ask again... What does systemctl cat docker show? And systemctl show docker? (Please edit your question to show the output of those commands.) – Stephen Kitt Sep 19 '19 at 7:22
1

I found the using the systemctl edit command was tricky (using Ubuntu 18.04), so I did this:

sudo mkdir /etc/systemd/system/docker.service.d
sudo vi /etc/systemd/system/docker.service.d/override.conf

then added the lines I required, in your case:
(and yes, the apparently empty first ExecStart= line is not a mistake)

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 --containerd=/run/containerd/containerd.sock

Next reload, restart and check it's listening on the specified port:

sudo systemctl daemon-reload
sudo systemctl restart docker.service
sudo netstat -lntp | grep dockerd
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.