I’ve managed to google this solution for using my local ssh key inside the container. It allows me to access git repositories and works ok.
services:
app:
...
environment:
SSH_AUTH_SOCK: /run/host-services/ssh-auth.sock
volumes:
- /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock
user: ${USER_ID}:${GROUP_ID}
Recently I’ve switched images and now I’m not using a root user anymore, but despite the user
option in the yaml config it’s still owned by root.
/var/www/html $ ls -lA /var/run/host-services/ssh-auth.sock
srw-rw---- 1 root root 0 May 15 11:47 /var/run/host-services/ssh-auth.sock
I’ve tried googling about this magic host-services
directory, but can’t find any info (the sock file does not exist in that directory on my host machine). Right now I have to run docker exec -u root app_name sh -c "chmod o+rw /var/run/host-services/ssh-auth.sock"
after each image build/computer reboot and I would like to solve this issue but have no idea where to begin.