Looking at the vscode documentation https://code.visualstudio.com/docs/remote/containers and section
3. After picking the starting point for your container, VS Code will add the dev container configuration files to your project (.devcontainer/devcontainer.json).
I can see that the correct container is launched each time, but I do not see a reference to it in the .devcontainer/devcontainer.json
{
"name": "myContainer",
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"lldb.executable": "/usr/bin/lldb",
// VS Code don't watch files under ./target
"files.watcherExclude": {
"**/target/**": true
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"bungcip.better-toml"
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
then in section https://code.visualstudio.com/docs/remote/containers#_create-a-devcontainerjson-file
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12",
If I am using docker desktop on windows how do format the uri to match the docker desktop container location? for example a docker ps -a
returns a NAME of interesting_mccarth
. I do not see how the above string matches to my container I wish to use as default.
In your example, the devcontainer.json
file references the Dockerfile
and it is the Dockerfile
that references the image to use.
"build": {
"dockerfile": "Dockerfile"
}
So whether it is a local or remote image that you want to reference inside your Dockerfile
is really up to you. Here is an SO answer describing how to use a local image inside a Dockerfile
.