如何使用 vscode 命令行附加远程容器? [英] How to attach a remote container using vscode command line?
本文介绍了如何使用 vscode 命令行附加远程容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用命令行工具来附加远程容器.我试过这个命令(见下文),但没有用.有人知道正确的命令吗?
I want to use a command line tool to attach a remote container. I tried this command (see below), but it's of no use. Does anyone know the correct command?
code --folder-uri vscode-remote://dev-container+4aaf623ee98a52fa311226a2c619be19addfa221c090b9a3bc37e7cba03a7fce/easycv
推荐答案
为了自动化这个,我创建了这个跨平台的解决方案:
To automate this, I created this cross-plattform-ish solution:
https://github.com/geircode/vscode-attach-to-容器脚本
此解决方案根据正在运行的容器的名称创建十六进制.
This solution creates the hex based on the name of the running container.
Windows CMD 脚本:
Windows CMD script:
docker run --rm geircode/string_to_hex bash string_to_hex.bash "<container_name>" > vscode_remote_hex.txt
set /p vscode_remote_hex=<vscode_remote_hex.txt
code --folder-uri=vscode-remote://attached-container+%vscode_remote_hex%/app
这篇关于如何使用 vscode 命令行附加远程容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文