Skip to content

docker: add pidFilePath to avoid waking a socket-activated daemon - #2176

Open
toby-bro wants to merge 1 commit into
wtfutil:trunkfrom
toby-bro:feat/docker_don_t_wake_socket_activated
Open

docker: add pidFilePath to avoid waking a socket-activated daemon#2176
toby-bro wants to merge 1 commit into
wtfutil:trunkfrom
toby-bro:feat/docker_don_t_wake_socket_activated

Conversation

@toby-bro

@toby-bro toby-bro commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I noticed that wtf would start my Docker daemon again within seconds of stopping it, keeping dockerd running (and burning CPU).

The cause is systemd socket activation (dockerd -H fd://) : systemd owns the listening socket and starts the daemon on the first connection, so polling the Docker API to find out whether the daemon is up starts it.
This PR adds a check that will read the dockerd's pid file, whose default location is documented as /var/run/docker.pid instead of querying the socket.
pkg/pidfile.Read also verifies the process is alive, so a stale file from a crashed daemon doesn't produce a false positive.

It is opt-in : with pidFilePath unset, the module behaves exactly as before.
If the installation is "standardish" then the pidFilePath: "auto" should manage to detect the actual location of the file.
Otherwise it can be manually specified.

It could reasonably become the default, but a wrong path reads as "daemon not running", and setups like Docker Desktop or a custom --pidfile have no file where we'd look so I didn't want to break anyone's wtf silently.

Unit tests for the new file were written with Claude.

@toby-bro

toby-bro commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I'll open a wtfdocs PR as soon as this has "ideological approval"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant