You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to use this is not working as expected for my teammate. It does work for others I work with, so I'm not sure if something unique to the machine or SSH agent setup is causing this. I'd love to figure out if there are issues with this feature or with the environment that are leading to this.
Reproduce
Ensure that the SSH agent is running: eval "$(ssh-agent -s)"
Add an ssh key that the agent is referencing (in our case, we're trying to access github ssh key from the container): ssh-add ~/.ssh/<path-to-key>
Now, from the mac environment, you'll be able to see that ssh key listed when running ssh-add -l
Run the docker container and attempt to view the ssh key from within the container: docker run --rm --mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" --entrypoint /usr/bin/ssh-add alpine/git -l
Expected behavior
What I'd expect to see if that we can access that ssh key within the docker container. Something like this:
Description
Docker for Mac has guidance to allow SSH agent forwarding from the mac environment into the container's environment: https://docs.docker.com/desktop/features/networking/#ssh-agent-forwarding
Attempting to use this is not working as expected for my teammate. It does work for others I work with, so I'm not sure if something unique to the machine or SSH agent setup is causing this. I'd love to figure out if there are issues with this feature or with the environment that are leading to this.
Reproduce
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<path-to-key>
ssh-add -l
docker run --rm --mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" --entrypoint /usr/bin/ssh-add alpine/git -l
Expected behavior
What I'd expect to see if that we can access that ssh key within the docker container. Something like this:
However, what we're seeing is that the key doesn't exist within the docker container:
The
The agent has no identities.
is unexpected.docker version
Client: Version: 27.4.0 API version: 1.47 Go version: go1.22.10 Git commit: bde2b89 Built: Sat Dec 7 10:35:43 2024 OS/Arch: darwin/arm64 Context: desktop-linux Server: Docker Desktop 4.37.2 (179585) Engine: Version: 27.4.0 API version: 1.47 (minimum version 1.24) Go version: go1.22.10 Git commit: 92a8393 Built: Sat Dec 7 10:38:33 2024 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.7.21 GitCommit: 472731909fa34bd7bc9c087e4c27943f9835f111 runc: Version: 1.1.13 GitCommit: v1.1.13-0-g58aa920 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Diagnostics ID
89690258-600A-4A1F-A057-1F99359E18DE/20250121200934
Additional Info
No response
The text was updated successfully, but these errors were encountered: