docker: add pidFilePath to avoid waking a socket-activated daemon - #2176
Open
toby-bro wants to merge 1 commit into
Open
docker: add pidFilePath to avoid waking a socket-activated daemon#2176toby-bro wants to merge 1 commit into
toby-bro wants to merge 1 commit into
Conversation
Contributor
Author
|
I'll open a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that
wtfwould 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.pidinstead of querying the socket.pkg/pidfile.Readalso verifies the process is alive, so a stale file from a crashed daemon doesn't produce a false positive.It is opt-in : with
pidFilePathunset, 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.