SSH Forwarding In DevContainer #224
Replies: 1 comment
-
|
I assume your dockerfile is using a variant of linux. I'm on Windows 11, and I can load up a docker image pretty simple w/ SSH forwarding. You may want to read up on it here: One thing I remember pulling my hair out was regarding you may need to upgrade your SSH on windows. Please refer to this article (https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH) on upgrading it... I was really shocked I needed to do this to fix my SSH. Once I did, everything just worked! In a nutshell, this is my workflow now a days:
ssh-add -l You should see something like this: 4096 SHA256:uuQ6KgGac+n+SwNjapiFtHQ2IOpwFG2VwfniXXXXXXX (RSA) If you're using github, you can use this to confirm access: ssh -T git@github.com It should say something like this: Hi hinate13! You've successfully authenticated, but GitHub does not provide shell access. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm hoping someone can help me on this, I am looking to setup SSH forwarding in the most simplest way imaginable, I've consulted many places where there is a brief outline and a description, but alas, none seem to work.
This is my
devcontainer.json:{ "build": { "dockerfile": "../Dockerfile", "context": "..", "target": "development" }, "customizations": { "vscode": { "extensions": [ "charliermarsh.ruff", "ms-python.mypy-type-checker", "ms-python.python", "ms-toolsai.jupyter", "tamasfe.even-better-toml" ] }, "recommendations": [ "charliermarsh.ruff", "ms-python.mypy-type-checker", "ms-python.python", "ms-toolsai.jupyter", "tamasfe.even-better-toml" ], "settings": { "[python]": { "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.semanticHighlighting.enabled": true }, "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, "editor.cursorBlinking": "smooth", "editor.cursorSmoothCaretAnimation": "on", "editor.cursorStyle": "line", "editor.formatOnSave": true, "editor.rulers": [ 88 ], "explorer.compactFolders": true, "explorer.confirmDelete": true, "ruff.codeAction.disableRuleComment": { "enable": true }, "ruff.enable": true, "ruff.fixAll": true, "ruff.importStrategy": "fromEnvironment", "ruff.lint.enable": true, "ruff.organizeImports": true }, "terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.profiles.linux": { "zsh": { "path": "zsh" } } }, "forwardPorts": [], "postStartCommand": "/bin/zsh", "runArgs": [ "--network=host", "--env-file", "${localWorkspaceFolder}/.devcontainer/.env.config", "--cap-add=SYS_TIME" ] }What do we have to do simply to get everything working together nicely on this? I have tried:
1. Standard SSH-Agent Forwarding via Dev Containers Feature
ssh-add --apple-use-keychain ~/.ssh/id_ed25519~/.ssh/configwith2. Manual Agent-Socket Bind via
mounts+containerEnveval "$(ssh-agent -s)"+ssh-add ~/.ssh/id_ed25519/ssh-agentsocket present in container butssh-add -lshows no identities3. Manual Agent-Socket Bind via
runArgs4. GUI vs. Terminal VS Code Launch Debug
code .in terminalterminal.integrated.inheritEnv$SSH_AUTH_SOCK, container still empty5. macOS Keychain + Config Tweak
ssh-add --apple-use-keychain ~/.ssh/id_ed25519~/.ssh/configsnippet as in https://github.com/nikepupu/language_grounding_cad120/pull/1#issue-1414123952 #16. Full
~/.sshDirectory Bind-Mount (No Agent)chmod 700 ~/.ssh+chmod 600 ~/.ssh/id_ed25519At this point I'm tearing my hair out with this for something that should be so simple.
Beta Was this translation helpful? Give feedback.
All reactions