Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

525
Views
How do I specify the dockerfile stage in Visual Studio Code Remote?

I have a multi-stage Dockerfile. I want to configure VS Code Remote to build the dev stage of the Dockerfile rather than the last stage in the Dockerfile.

I'm pretty sure this configuration would go in the .devcontainer.json file. I've read through the .devcontainer.json reference: https://code.visualstudio.com/docs/remote/containers#_devcontainerjson-reference and tried runArgs, but these are the run-time args, not the build args.

I tried this:

{
        "dockerFile": "Dockerfile",
        "extensions": ["ms-python.python"],
        "runArgs": [
                "--target",
                "dev"
        ]
}

and:

{
        "dockerFile": "Dockerfile",
        "extensions": ["ms-python.python"],
        "buildArgs": [
                "--target",
                "dev"
        ]
}

When I used runArgs, I got Failed: Starting the development container because target is not a docker run option. When I tried buildArgs, the argument was apparently ignored, which makes sense since it isn't listed in the documentation.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

runArgs specifies the arguments to use with the "docker run" command. In this case, we need to pass arguments to the "docker build" command.

For specifying build arguments, you need to use the "build" property. In your example, you would need your devcontainer.json file to contain:

"build": { 
    "target": "dev" 
},
over 4 years ago · Santiago Trujillo Report

0

You can use Dev Container: Existing Docker Compose mode. docker-compose service can specified Dockerfile stage.

over 4 years ago · Santiago Trujillo Report

0

I found a workaround.

I can manually build the Dockerfile myself:

docker build --target dev -t vizd .

and then use the image parameter in .devcontainer.json:

{
    "image": "vizd",
    "extensions": ["ms-python.python"]
}

Not perfect, but doable.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!