Andy Thomas
Andy Thomas

Reputation: 1309

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?

Upvotes: 4

Views: 6969

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146510

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

Upvotes: 3

Related Questions