k3d with podman remote does not need DOCKER_SOCK#1632
k3d with podman remote does not need DOCKER_SOCK#1632niule-eu wants to merge 1 commit intok3d-io:mainfrom
Conversation
When using k3d with a remote podman socket, it seems to be necessary to set DOCKER_HOST to a combination of DOCKER_HOST and DOCKER_SOCK
There was a problem hiding this comment.
Pull request overview
This PR updates the remote Podman documentation to simplify the setup by combining DOCKER_HOST and DOCKER_SOCK into a single SSH URL. The format ssh://username@hostname/socket/path aligns with Podman's native connection URI format as shown in podman system connection ls output.
Key changes:
- Consolidates
DOCKER_HOSTandDOCKER_SOCKenvironment variables into a singleDOCKER_HOSTSSH URL that includes the socket path - Removes the need to separately export
DOCKER_SOCKfor remote Podman connections
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
| export DOCKER_HOST=ssh://username@hostname | ||
| export DOCKER_SOCK=/run/user/1000/podman/podman.sock | ||
| export DOCKER_HOST=ssh://username@hostname/run/user/1000/podman/podman.sock |
There was a problem hiding this comment.
The removal of DOCKER_SOCK may cause issues with features that use the tools container. The DOCKER_SOCK environment variable is read by k3d's GetRuntimePath() function (in pkg/runtimes/docker/docker.go:96) and used to mount the socket into the tools container (in pkg/client/tools.go:436).
When DOCKER_SOCK is not set, it defaults to /var/run/docker.sock, which would be incorrect for rootless Podman where the socket is at /run/user/1000/podman/podman.sock. While including the socket path in the DOCKER_HOST SSH URL works for the Docker client library, k3d doesn't currently parse the socket path from SSH URLs in GetRuntimePath().
Consider either:
- Keeping
DOCKER_SOCKas a separate variable (as shown in the macOS section examples at lines 138-140 and 148-149), or - Updating k3d's code to extract the socket path from SSH-protocol
DOCKER_HOSTURLs
Note: Line 139 also has an inconsistency - it uses DOCKER_SOCKET instead of DOCKER_SOCK.
| export DOCKER_HOST=ssh://username@hostname/run/user/1000/podman/podman.sock | |
| export DOCKER_HOST=ssh://username@hostname/run/user/1000/podman/podman.sock | |
| export DOCKER_SOCK=/run/user/1000/podman/podman.sock |
What
The remote podman section in the advanced usage docs did not work for me. Changing DOCKER_HOST to
export DOCKER_HOST=ssh://username@hostname/run/user/1000/podman/podman.sockdid.Why
When using k3d with a remote podman socket, it seems to be necessary to set DOCKER_HOST to a combination of DOCKER_HOST and DOCKER_SOCK
Implications
This has the potential to improve the docs. I was not able to confirm if this is an issue only relevant to my setup or to others as well.