The following file is within .devcontainer/devcontainer.json:
// See https://containers.dev/implementors/json_reference/ for configuration reference
{
"name": "my-devcontainer",
"build": {
"dockerfile": "Dockerfile"
},
"postCreateCommand": "bash ./my-background-script.sh && bash ./my-foreground-script.sh",
"remoteUser": "node"
}
Note the postCreateCommand:
- I would like
my-foreground-script.shto run the VS Code terminal- need this script to be visible
- it is interactive, and the user must be able to type inputs into it
- I would like
my-background-script.shto run separately- it may run as a background task, invisible to the user
- it may also run in the VS Code terminal, visible to the user
- where it runs does not matter
Right now, both scripts run in the background, so 2. is OK, but 1. is not.
How can I configure .devcontainer/devcontainer.json such that the above happens?
jonrsharpe
123k31 gold badges278 silver badges489 bronze badges
asked Aug 26, 2025 at 7:30
bguiz
28.5k49 gold badges165 silver badges258 bronze badges