Show Menu
Cheatography

DevContainer Cheat Sheet by

Visual Studio Code DevContainers Cheat Sheet

Files and Direct­ories

Devcon­tainer specific files are in the
.devco­ntainer
directory at the root of the project.
The main config­uration file is
devcon­tai­ner.json
in the
.devco­ntainer
directory.

mcr.mi­cro­sof­t.c­om/­vsc­ode­/de­vco­nta­ine­rs/...

base
python
ruby
dotnet
javasc­rip­t-node
cpp
go
anaconda
typesc­rip­t-node
php
java
miniconda
universal
rust
dotnetcore
jekyll

Dockerfile tag list

debian-10 ("bu­ste­r") and ubuntu­-20.04 ("fo­cal­") are not always available for the ARM64 archit­ecture (Mac M1)

.devco­ntainer

image
string
Name of the image in a container registry
build.d­oc­kerfile
/
dockerFile
string
Location of the Dockerfile that defines the contents of the container
docker­Com­pos­eFile
string, array
Path or an ordered list of paths to Docker Compose files relative to the
devcon­tai­ner.json
file
service
string
Name of the service VS Code should connect to once running

Simple .devco­ntainer with Docker image

{
    "name": "Go Demo",
    "image": "mcr.microsoft.com/vscode/devcontainers/go:1.18-bullseye"
}

.devco­ntainer with Dockerfile

{
    "name": "Dockerfile Example",
    "build": {
        "dockerfile": "Dockerfile"
    }
}

.devco­ntainer with docker­-co­mpose

{
    "name": "Docker Compose Example",
    "dockerComposeFile": "docker-compose.yml",
    "service": "service-to-start-in-vscode",
    "workspaceFolder": "/workspace",
    "shutdownAction": "stopCompose",

    "settings": {},
    "extensions": [
        "ms-vscode.cpptools"
    ]
}

VS Code Command Palette (>r­emo­te-­con­tai­ner­s:...)

Reopen in Container
Reopen Folder Locally
Rebuild Container
Rebuild Container Without Cache

Useful links

       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Sublime Text 2 Windows Keyboard Shortcuts
          Selenium WebDriver Cheat Sheet Cheat Sheet
          ISTQB Test Automation Engineering Cheat Sheet