Skip to content

Service won't start since pid file is found #27

@bhaeussermann

Description

@bhaeussermann

OS: Ubuntu 22.04.1 LTS

I used the template to create a service for starting the docker daemon.

Starting the service:

$ sudo /etc/init.d/docker start
Starting docker

Querying status:

$ sudo /etc/init.d/docker status
Stopped

Surely enough, the docker daemon isn't running at this stage.

Checking the error log /var/log/docker.err I see

time="2023-05-05T12:31:24.062889666Z" level=info msg="Starting up"
failed to start daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid

Deleting the docker.pid file and starting the service again yields the same result.

If I delete the line

echo $! > "$pid_file"

from the script, the service works as expected and the docker.pid is automatically created with the correct PID.

It appears that the System V init script isn't supposed to be writing the docker.pid file, but should be leaving that to init.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions