惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
Vercel News
Vercel News
Recent Announcements
Recent Announcements
博客园 - Franky
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
宝玉的分享
宝玉的分享
I
InfoQ
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
V
V2EX
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
T
The Blog of Author Tim Ferriss
量子位

hsfzxjy 的博客

解决 VSCode + CMake + MSVC 编译器信息乱码的问题 使用 3090 部署 1.58bit 动态量化版 DeepSeek R1 671b 如何在 VS Code DevContainer 中配置 HTTP 代理 Cohesive Digests for Ints and Floats Rust 中的隐匿概念 —— Place(位置) 美术馆 一尺之槌,日取其半,1075日而竭 老生常谈:使用 Cloudflare 自选 IP 加速站点访问 辩义 State、Nation 与 Country 将 Base64 编码的数据快速转换为 Uint8Array 折腾 NPU·第1章 —— 搭建 Level Zero 开发环境 折腾 NPU·第0章 —— Intel NPU 概述与 Level-Zero 新增域名 monad.run CSS 中为特定字符设置不同字体 Arbitary Lifetime Transmutation via Rust Unsoundness Dijkstra 算法的延伸 Manacher 回文计数算法 硬卧 Go Fact: Zero-sized Field at the Rear of a Struct Has Non-zero Size Display *big.Rat Losslessly and Smartly in Golang 代码的仪式 Building Electron From Scratch 中式亲属称谓研究之一:构建半群 Some Notes on Kotlin Coroutines Git sparse-checkout and partial clones for Mega-Repos 辩义“封建” Diving from the CUDA Error 804 into a bug of libnvidia-container Modern Cryptography, GPG and Integration with Git(hub) Move the Root Partition of Ubuntu A New Programmer Kicks a Roadblock
如何在跳板机背后的服务器上使用 VS Code Remote - Containers
2025-01-20 · via hsfzxjy 的博客

假设有如下网络拓扑:

LOCALSERVER J202.X.X.XSERVER B10.X.X.XJUSERBUSER

其中 Server J 是跳板机,Server B 是目标服务器。现在需要让 VSCode 经由 Server J 连接到 Server B,并在 Server B 上使用 Remote - Containers 插件开启一个容器。

设置 SSH 代理

在本地的 ~/.ssh/config 中添加如下配置:

Host server-j
HostName 202.x.x.x
User juser
IdentityFile ~/.ssh/id_rsa_juser

Host server-b
HostName 10.x.x.x
User buser
ProxyCommand ssh -q -W %h:%p server-j
IdentityFile ~/.ssh/id_rsa_buser

此处注意:

  1. 两个配置的用户名是不同的,其中使用 juser 从本地连接到 Server J,再使用 buser 从 Server J 连接到 Server B。读者可以根据实际情况修改。
  2. 两个配置的密钥文件也是不同的,分别是 ~/.ssh/id_rsa_juser~/.ssh/id_rsa_buser但是这两个文件都需要存在本地。读者需要根据实际情况修改。
  3. server-bserver-j 是自定义的别名,可以根据实际情况修改。

配置完成后,即可在 VSCode 中按 Ctrl+Shift+P,选择 Remote-SSH: Connect to Host,选中 server-b 一项,即可通过跳板连接到 Server B。

在 Server B 使用 Remote - Containers

至此后的操作与在本地使用 Remote - Containers 没有区别。例如你可以直接在 Server B 的项目目录下新建 .devcontainer.json 文件,然后在 VSCode 中打开该目录,选择 Reopen in Container 即可。

{
"image": "sdcpp_dev",
"runArgs": ["--gpus", "all"]
}

后续

后续我会更新其他关于 DevContainers 使用的文章,讨论如下话题:


作者:hsfzxjy
链接:
许可:CC BY-NC-ND 4.0.
著作权归作者所有。本文不允许被用作商业用途,非商业转载请注明出处。