"Error connecting to agent: permission denied" when forwarding 1Password SSH agent to Docker
I am trying to mount the 1Password SSH agent's socket inside a Docker container using the process described in https://docs.docker.com/desktop/networking/#ssh-agent-forwarding.
In my docker-compose.yml I have:
yaml
services:
servicename:
environment:
- SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
volumes:
- type: bind
source: /run/host-services/ssh-auth.sock
target: /run/host-services/ssh-auth.sock
On the (Mac) host:
$SSH_AUTH_SOCKis set to~/.1password/agent.sock, which is a symlink to~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sockas recommended in the https://developer.1password.com/docs/ssh/get-started/#step-4-configure-your-ssh-or-git-client- running
ssh-add -Lproduces the expected list of keys stored in 1Password
However, when I try to access the agent from inside the container, I get:
(base) jovyan@5bfec89674ae:~$ echo $SSH_AUTH_SOCK
/run/host-services/ssh-auth.sock
(base) jovyan@5bfec89674ae:~$ ssh-add -L
Error connecting to agent: Permission denied
(base) jovyan@5bfec89674ae:~$
Things I have tried which don't make any difference:
- Setting the host's
$SSH_AUTH_SOCKexplicitly to the~/Library/Group Containers/…location rather than to the symlink - Setting
ForwardAgent yesin~/.ssh/config
The Docker daemon is running as me so should have the necessary permissions on the .sock file.
Any idea what I'm doing wrong?
1Password Version: 8.8.0
Extension Version: Not Provided
OS Version: macOS 12.5.1
Browser:_ Not Provided
