kin*_*hat 9 terminal containers docker visual-studio-code
如果您运行 a,post*Command您将获得一个运行命令并输出的集成终端:
从 devcontainer.json 运行 PostCreateCommand...
[2709 毫秒] 开始:在容器中运行:...
完毕。按任意键关闭终端。
有没有办法让这个自动关闭并打开用户终端,或者只是保留它并打开用户终端,就好像您根本没有运行任何命令一样devcontainer.json?
使用涉及 Python 的示例,您可以尝试使用postAttachCommand:
{
"postCreateCommand": ["poetry", "install"],
"postAttachCommand": "bash"
}
Run Code Online (Sandbox Code Playgroud)
这使:
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#
Run Code Online (Sandbox Code Playgroud)
的描述postCreateCommand如下:
创建容器后运行的命令。此命令在“updateContentCommand”之后和“postStartCommand”之前运行。
而 的描述postAttachCommand指定:
连接到容器时要运行的命令。该命令在“postStartCommand”之后运行。
所以其他变化可能是可能的,但这个对我有用。
| 归档时间: |
|
| 查看次数: |
1847 次 |
| 最近记录: |