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}}