diff --git a/docker-for-mac/faqs.md b/docker-for-mac/faqs.md index 3073ef8773..10b0b5a051 100644 --- a/docker-for-mac/faqs.md +++ b/docker-for-mac/faqs.md @@ -76,6 +76,10 @@ We recommend that you publish a port, or connect from another container. You can For more information and examples, see [I want to connect to a container from the Mac](networking.md#i-want-to-connect-to-a-container-from-the-mac) in the [Networking](/docker-for-mac/networking/) topic. +### Can I use an SSH agent inside a container? + +Yes, you can use the host’s SSH agent inside a container. For more information, see [SSH agent forwarding](/docker-for-mac/osxfs/#ssh-agent-forwarding). + ### How do I add custom CA certificates? Docker Desktop supports all trusted certificate authorities (CAs) (root or intermediate). For more information on adding server and client side certs, see diff --git a/docker-for-mac/networking.md b/docker-for-mac/networking.md index c7f8d2110b..b030955694 100644 --- a/docker-for-mac/networking.md +++ b/docker-for-mac/networking.md @@ -41,7 +41,7 @@ syntax for `-p` is `HOST_PORT:CLIENT_PORT`. ### HTTP/HTTPS Proxy Support -See [Proxies](index#proxies). +See [Proxies](/docker-for-mac/index/#proxies). ## Known limitations, use cases, and workarounds diff --git a/docker-for-mac/osxfs.md b/docker-for-mac/osxfs.md index 46bb98d29d..11e433991c 100644 --- a/docker-for-mac/osxfs.md +++ b/docker-for-mac/osxfs.md @@ -153,6 +153,32 @@ Extended attributes are not yet supported. `osxfs` does not use OSXFUSE. `osxfs` does not run under, inside, or between macOS userspace processes and the macOS kernel. +### 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 + ``` + ### Performance issues, solutions, and roadmap > See **[Performance tuning for volume mounts (shared filesystems)](osxfs-caching.md)**