Need to edit following entries:

# 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:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID

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

$ sudo -E systemctl edit docker.service
ExecStart=/usr/bin/dockerd -H fd:// -H tcp:// --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? Sep 18, 2019 at 16:14
  • @StephenKitt No it doesn't but why systemctl restart doesn't? Sep 18, 2019 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, 2019 at 16:30
  • Another issue is, systemctl restart in EC2 requires passwd, which I don't know Sep 18, 2019 at 16:31
  • 1
    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.) Sep 19, 2019 at 7:22

1 Answer 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)

ExecStart=/usr/bin/dockerd -H fd:// -H tcp:// --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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .