1

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:

  1. I would like my-foreground-script.sh to 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
  2. I would like my-background-script.sh to 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

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.