Docker Community Forums

Share and learn in the Docker community.

Ssh-agent forwarding into docker-compose environment is not working

Hi All,
I have been having serious troubles to get ssh-agent forwarding with my docker-compose installation. I have Mac running Catalina, with docker-engine 19.03.8, Compose @ 1.24

The following is my docker-compose file

version: '3.7'
services:
  platform:
    container_name: platform
    build:
      context: .
      dockerfile: ./platform/compose/Dockerfile.platform.local
    working_dir: /root/platform
    ports:
      - "3000:3000"
    command: ["./compose/scripts/start_rails.sh"]
    tty: true
    stdin_open: true
    volumes:
      - type: bind
        source: /run/host-services/ssh-auth.sock
        target: /run/host-services/ssh-auth.sock
    env_file: ./platform/.env
    environment:
      TERM: xterm-256color
      SSH_AUTH_SOCK: /run/host-services/ssh-auth.sock

volumes:

Before I start docker-compose up, I did eval ssh-agent to verify ssh-agent is running and added my private key. But for some reason, I can never get the ssh-agent to forward into the machine.

Any help is much appreciated.

If anyone stumbles on this, please check https://stackoverflow.com/questions/61524982/ssh-agent-forwarding-into-docker-compose-environment-is-not-working