if you run a post*Command
you get an integrated terminal that runs the command(s) and outputs:
Running the PostCreateCommand from devcontainer.json...
[2709 ms] Start: Run in container: ...
Done. Press any key to close the terminal.
is there a way to have this auto close and open a user terminal or just leave it and open a user terminal as if you werent running any commands from devcontainer.json
at all?
Using an example involving Python, you can try using postAttachCommand
:
{
"postCreateCommand": ["poetry", "install"],
"postAttachCommand": "bash"
}
which gives:
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#
The description for postCreateCommand
reads:
A command to run after creating the container. This command is run after "updateContentCommand" and before "postStartCommand" .
whereas the description for postAttachCommand
specifies:
A command to run when attaching to the container. This command is run after "postStartCommand".
So other variations might be possible, but this one worked for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.