podman build --ssh default on windows #28310
Replies: 1 comment
-
|
The 1. Make sure your SSH agent is running and has keys loadedInside your WSL2 session (not PowerShell), check: ssh-add -lIf you get "Could not open a connection to your authentication agent", start it first: eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519 # or whichever key you use for GitHubThe 2. Run the build from WSL2, not PowerShellWhen you run Podman from PowerShell with WSL2 backend, the SSH agent socket forwarding can break because the socket path does not translate cleanly between Windows and the WSL2 VM. Run the build directly from your WSL2 terminal instead: # Inside WSL2
podman build --ssh default -t github-ssh-test:latest -f ./Dockerfile .3. Drop the DOCKER_BUILDKIT env var
4. Verify the Dockerfile syntaxYour Dockerfile looks correct, but make sure the podman version
buildah versionIf you are on a recent Podman (4.x or 5.x), the syntax is supported. 5. Debug the SSH connectionIf it still fails, add verbose output to the SSH command in your Dockerfile to see what is happening: RUN --mount=type=ssh ssh -vvv -T git@github.com 2>&1 || trueThis will show you whether the SSH socket is being mounted and whether keys are available inside the build context. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to build an image that requires pulling external Git dependencies over SSH. When I was building this image on Docker, it was working. I'm wondering if it's supposed to work on Podman on Windows using WSL2 as well.
I did a simple image test:
I use this command to run it on Podman:
$env:DOCKER_BUILDKIT=1; podman build --ssh default -t github-ssh-test:latest -f ./Dockerfile .I tried looking around the documentation and different GitHub issues related to SSH, but I didn't find a clear response.
Beta Was this translation helpful? Give feedback.
All reactions