[英]How to make VSCode terminal log in as a non-root user when attaching to an existing remote container
[英]vscode-remote-container open user terminal after post*Command
如果您运行post*Command
,您将获得一个运行命令和输出的集成终端:
从 devcontainer.json 运行 PostCreateCommand...
[2709 毫秒] 开始:在容器中运行:...
完毕。 按任意键关闭终端。
有没有办法让这个自动关闭并打开一个用户终端,或者只是离开它并打开一个用户终端,就好像你根本没有运行来自devcontainer.json
的任何命令一样?
使用涉及 Python 的示例,您可以尝试使用postAttachCommand
:
{
"postCreateCommand": ["poetry", "install"],
"postAttachCommand": "bash"
}
这使:
Running the postCreateCommand from devcontainer.json...
[28000 ms] Start: Run in container: poetry install
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: project (0.1.0)
Running the postAttachCommand from devcontainer.json...
[33815 ms] Start: Run in container: /bin/sh -c bash
root@a0fd27a3b2cc:/workspaces/directory#
postCreateCommand
的描述如下:
创建容器后要运行的命令。 此命令在 "updateContentCommand" 之后和"postStartCommand" 之前运行。
而postAttachCommand
的描述指定:
附加到容器时运行的命令。 此命令在“postStartCommand”之后运行。
所以其他变化可能是可能的,但这个对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.