V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
COW
0D

Dev Container 下复用 WSL 中的 SSH Key

  •  
  •   COW · Dec 31, 2025 · 1507 views
    This topic created in 117 days ago, the information mentioned may be changed or developed.
    从 WSL 终端 ssh 到局域网中其他 VM 机器很容易,在 Dev Container 里有点麻烦。

    比如我要通过 Dev Container 里跑 ansible 控制多个 VM ,这里就需要复用 WSL 的 SSH key 。

    手动写命令启动 ssh-agent 可以实现,但操作不够方便,这里写了个简单脚本,支持开机自启,有类似场景的自取。

    https://github.com/kiddingbaby/ssh-agent-in-wsl/tree/main
    1 replies    2025-12-31 20:24:53 +08:00
    craftsmanship
        1
    craftsmanship  
       Dec 31, 2025 via Android
    直接 bind mounts+post commands 就可以了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1182 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 23:23 · PVG 07:23 · LAX 16:23 · JFK 19:23
    ♥ Do have faith in what you're doing.