Skip to content

Commit a6ad5dc

Browse files
committed
Add SSH troubleshooting section to DevContainers article
1 parent f8fea78 commit a6ad5dc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

content/articles/containers/devcontainers.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,31 @@ RUN apk add --no-cache git-lfs
112112
113113
EXPOSE 1313
114114
```
115+
116+
## SSH Troubleshooting
117+
118+
Normally, VSCode *automatically* forwards the host's ssh-agent into the DevContainer. Here's how this normally works and that can give you a hint at where the problem is.
119+
120+
To see, if ssh works inside the devcontainer (i.e. the ssh-agent from the host is correctly routed to the container), execute:
121+
122+
```sh
123+
$ ssh-add -l
124+
4096 SHA256:WJ2WxTG1F4bHWq29eN+lvc/5VYLhjAZp5b5555PkGis Primary SSH Key (RSA)
125+
```
126+
127+
If this gives you an error, check `$SSH_AUTH_SOCK`:
128+
129+
```sh
130+
$ echo $SSH_AUTH_SOCK
131+
/tmp/vscode-ssh-auth-2d206968-2061-406b-8a9f-a4a2249dc649.sock
132+
```
133+
134+
If this variable is empty, search the contents of the container log (F1 > Dev Containers: Show Container Log) for "SSH_AUTH_SOCK":
135+
136+
```
137+
[16730 ms] Start: Launching Dev Containers helper.
138+
[16730 ms] ssh-agent: SSH_AUTH_SOCK not set on local host.
139+
[16732 ms] ssh-agent: SSH_AUTH_SOCK in container (/tmp/vscode-ssh-auth-2d206968-2061-406b-8a9f-a4a5349dc649.sock) forwarded to local host (\\.\pipe\openssh-ssh-agent).
140+
```
141+
142+
If this doesn't work and you are on Windows, it *may* help to manually set the `SSH_AUTH_SOCK` environment variable to `\\.\pipe\openssh-ssh-agent` ([source](https://github.com/microsoft/vscode-remote-release/issues/11043#issuecomment-3005677524)).

0 commit comments

Comments
 (0)