VS Code Dev Container
Sources:
- Developing inside a Container from VS Code.
- Custom Dev Container Features from VS Code.
- See my github repo for my DevContainer confguration.
Dev container
See Developing inside a Container from VS Code.
Start VS Code, run the Dev Containers: Open Folder in Container... command from the Command Palette (F1) or quick actions Status bar item, and select the project folder you would like to set up the container for.
Tip: If you want to edit the container's contents or settings before opening the folder, you can run Dev Containers: Add Dev Container Configuration Files... instead.
Use
Dev Containers: Open Container Configuration File
in the Command Palette (Ctrl+Shift+P
) to do your customization.- The Dev Containers extension uses the files in the
.devcontainer
folder, namelydevcontainer.json
, and an optionalDockerfile
ordocker-compose.yml
, to create your dev containers.
- The Dev Containers extension uses the files in the
To use images supporting CUDA, make sure you have NVIDIA Container Toolkit installed. Then add this to your .devcontainer.json
:
1 | "runArgs": [ |
Or, you can just use the docker image:
1 | docker pull lyklove/ml:1.0 |
Add features in dev-container
You can also explore official and publicly contributed Features on the specification site. Any Feature can be added by editing devcontainer.json
.
Add extensions in dev-container
While you can edit your devcontainer.json file by hand to add a list of extension IDs, you can also right-click on any extension in the Extensions view and select Add to devcontainer.json.
Custumize image
See Create a Dev Container
Usually, you will use a base image (provided by VS Code):
1 | { |
However, you can use your own image in "image"
field. Meanwhile, you can replace the image
property in devcontainer.json
with dockerfile
to build from your Dockerfile
:
1 | { |
My dev-container config
Sources:
- Setup a NVIDIA DevContainer with GPU Support for Tensorflow/Keras on Windows
- Containerization of CUDA environment using VSCode
1 | { |