From 86cac4de75fced27776df2696dd547676a20c472 Mon Sep 17 00:00:00 2001 From: Christian Vogel Date: Sat, 20 Mar 2021 19:16:41 +0100 Subject: [PATCH] recovered ssh agent forwarding documentation The documentation about ssh agent forwarding got lost when osxfs.md was deleted. So I just want to add the old documentation again at some place where users might look for it. This is the commit of the old documentation: https://github.com/docker/docker.github.io/commit/4dc68449055a8b734a1246004384de52144fd3fe#diff-124453101199ad6385df8981138b4ede623649e8b8b62ee7782be41830034b3a --- desktop/mac/networking.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/desktop/mac/networking.md b/desktop/mac/networking.md index 9739b5f047..4304980c84 100644 --- a/desktop/mac/networking.md +++ b/desktop/mac/networking.md @@ -44,6 +44,32 @@ syntax for `-p` is `HOST_PORT:CLIENT_PORT`. See [Proxies](index.md#proxies). +### SSH agent forwarding + +Docker Desktop for Mac allows you to use the host’s SSH agent inside a container. To do this: + +1. Bind mount the SSH agent socket by adding the following parameter to your `docker run` command: + + `--mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock` + +1. Add the `SSH_AUTH_SOCK` environment variable in your container: + + `-e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock"` + +To enable the SSH agent in Docker Compose, add the following flags to your service: + + ```yaml +services: + web: + image: nginx:alpine + volumes: + - type: bind + source: /run/host-services/ssh-auth.sock + target: /run/host-services/ssh-auth.sock + environment: + - SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock + ``` + ## Known limitations, use cases, and workarounds Following is a summary of current limitations on the Docker Desktop for {{Arch}}