Skip to content

Commit 4dc6844

Browse files
authored
Add info on ssh agent usage (docker#10184)
* Add info on ssh agent usage * moved instructions to the networking topic * address review comments * removed an extra line in the faq
1 parent 23b2393 commit 4dc6844

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

docker-for-mac/faqs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ We recommend that you publish a port, or connect from another container. You can
7676
For more information and examples, see
7777
[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.
7878

79+
### Can I use an SSH agent inside a container?
80+
81+
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).
82+
7983
### How do I add custom CA certificates?
8084

8185
Docker Desktop supports all trusted certificate authorities (CAs) (root or intermediate). For more information on adding server and client side certs, see

docker-for-mac/networking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ syntax for `-p` is `HOST_PORT:CLIENT_PORT`.
4141

4242
### HTTP/HTTPS Proxy Support
4343

44-
See [Proxies](index#proxies).
44+
See [Proxies](/docker-for-mac/index/#proxies).
4545

4646
## Known limitations, use cases, and workarounds
4747

docker-for-mac/osxfs.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,32 @@ Extended attributes are not yet supported.
153153
`osxfs` does not use OSXFUSE. `osxfs` does not run under, inside, or
154154
between macOS userspace processes and the macOS kernel.
155155

156+
### SSH agent forwarding
157+
158+
Docker Desktop for Mac allows you to use the host’s SSH agent inside a container. To do this:
159+
160+
1. Bind mount the SSH agent socket by adding the following parameter to your `docker run` command:
161+
162+
`--mount type=bind,src=/run/host-services/ssh-auth.sock,target=/run/host-services/ssh-auth.sock`
163+
164+
1. Add the `SSH_AUTH_SOCK` environment variable in your container:
165+
166+
`-e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock"`
167+
168+
To enable the SSH agent in Docker Compose, add the following flags to your service:
169+
170+
```yaml
171+
services:
172+
web:
173+
image: nginx:alpine
174+
volumes:
175+
- type: bind
176+
source: /run/host-services/ssh-auth.sock
177+
target: /run/host-services/ssh-auth.sock
178+
environment:
179+
- SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
180+
```
181+
156182
### Performance issues, solutions, and roadmap
157183
158184
> See **[Performance tuning for volume mounts (shared filesystems)](osxfs-caching.md)**

0 commit comments

Comments
 (0)