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.