Allow DOCKER_HOST override in rootless Docker setup - #16
Merged
Conversation
f3l1x
force-pushed
the
claude/docker-host-env-var-07o59y
branch
from
August 10, 2026 17:15
4267ab6 to
cc7a90a
Compare
The rootless Docker setup hardcoded DOCKER_HOST in /etc/profile and in dockerd-rootless-start, clobbering any value supplied by the environment (workspace template, docker run -e, mounted host socket, remote daemon). Both now treat the rootless socket as a fallback only. The startup script skips starting a daemon when one already answers at DOCKER_HOST, derives XDG_RUNTIME_DIR from a provided unix .../docker.sock so dockerd and the CLI agree on the path, and fails with a clear message for non-unix hosts it cannot serve. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017jPxeenJt19PJStMMeb1Em
f3l1x
force-pushed
the
claude/docker-host-env-var-07o59y
branch
from
August 10, 2026 17:16
cc7a90a to
2c56d86
Compare
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.
Summary
This change makes the rootless Docker configuration respect an existing
DOCKER_HOSTenvironment variable, allowing users to override the default socket location or use alternative Docker daemons (mounted host sockets, remote daemons, etc.).Key Changes
dockerd-rootless-start.sh:
DOCKER_HOSTenvironment variable instead of always overwriting itDOCKER_HOSTDOCKER_HOSTpoints to a unix socket path ending in/docker.sockXDG_RUNTIME_DIRfrom theDOCKER_HOSTpath to keep the daemon and CLI in agreementDOCKER_HOSTis set to an unsupported valueDockerfile:
/etc/profileto useDOCKER_HOST="${DOCKER_HOST:-...}"pattern, making the default conditionalREADME.md:
XDG_RUNTIME_DIRandDOCKER_HOSTare defaults onlydockerd-rootless-startwhenDOCKER_HOSTis pre-configuredImplementation Details
The startup script now follows this logic:
DOCKER_HOSTfrom environment if set, otherwise default to the rootless socket pathDOCKER_HOSTis a unix socket path and deriveXDG_RUNTIME_DIRfrom itThis enables flexible deployment scenarios while maintaining backward compatibility with existing setups.
https://claude.ai/code/session_017jPxeenJt19PJStMMeb1Em