Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker service doesn't start after boot

I am trying to figure out why my docker service doesn't run automatically on reboot.

Here it is:

$ sudo cat /etc/systemd/system/docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --insecure-registry=some-registry

When I try: $ sudo systemctl enable docker.service nothing happens.

The status of this service under list-unit-files:

$ sudo systemctl list-unit-files | grep docker
docker.service           static

If I start the service manually (sudo systemctl start docker.service) it works as expected though.

Any ideas why?

like image 995
Andy Thomas Avatar asked Sep 16 '25 07:09

Andy Thomas


1 Answers

The issue is because you have not specified any target in your service. You should change the service file as below

$ sudo cat /etc/systemd/system/docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --insecure-registry=some-registry

[Install]
WantedBy=multi-user.target

After that run the below commands

systemctl daemon-reload 
systemctl disable docker
systemctl enable docker

And restart the system

like image 110
Tarun Lalwani Avatar answered Sep 19 '25 16:09

Tarun Lalwani