Skip to content

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

Merged
FelicianoTech merged 1 commit into
wtfutil:trunkfrom
toby-bro:feat/docker_don_t_wake_socket_activated
Sep 29, 2026
Merged

FelicianoTech merged 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"

@FelicianoTech FelicianoTech left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you as usual. If you can get the website PR going when you can, I would appreciate it. This can go into v0.51.0 which is likely today or tomorrow.

One note, there will be some major changes happening to this project soon, including policies put into place around AI. Just a heads up.

Thank you!

@FelicianoTech
FelicianoTech merged commit 0d70760 into wtfutil:trunk Sep 29, 2026
4 checks passed
@toby-bro

Copy link
Copy Markdown
Contributor Author

Updated in wtfutil/wtfdocs#208, looking forward to the evolutions.
Thanks again, for having taken up the project.

@toby-bro
toby-bro deleted the feat/docker_don_t_wake_socket_activated branch September 29, 2026 16:06
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.

2 participants

⌂ 换网址