Skip to content

Add a Dev Container #9

@github-actions

Description

@github-actions

🤷‍♂️ Why

A Devcontainer implies that your IDE is utilizing a container for your terminal and all your automations. This is nice because a container is lightweight construct, that can be build from code. Consequently all team mates always work in the exact same environment, based off a declarative version controlled recipe stored in the repository.

A Devcontainer is a JSONflavour added to the container image during build. It's designed to make life easier for software developers.

Caution

The image you choose as your foundation may limit what you can do and where it can run.

Tip

In GitHub context a safe bet is to go with ubuntu-latest. This runner is the fastest one to launch in Workflows (not because it's slim, but because GitHub favors it). And for that same reason it's also the only container that is supported in copilot-setup-steps.yml1
The Ubuntu noble (nick name for 24-04) from the VS Code context matches ubuntu-latest in GitHub workflow context2.
And it is compliant with both MacOS, Windows and Linus and both ARM64 and AMD64

💬 Prompt

Create a devcontainer in the default location '.devcontainers/devcontainer.json'.
The image should be Ubuntu:noble and add the additional features 'GitHub CLI', 
'Common Utilities', Python' and 'Go'

🛠️ D.I.Y.

  • From the Command Palette3 in VS Code

Dev Containers:Add Dev Container Configurations Files...

  • Add configuration to workspace
    • Ubuntu
      • noble
    • Select additional features to install
      • GitHub CLI ('devcontainers')
      • Common Utilities ('devcontainers')
      • Python ('devcontainers')
      • Go ('devcontainers')
    • Keep Defaults
    • Include .github/dependabot

The steps above will create .devcontainer/devcontainer.json

  • Reopen in container

Command Palette

Dev Containers:Reopen in Container

  • Test:

Open a terminal and run

lsb_release -a

It should show the detailed distribution information (release, codename, etc.)

##🤖 Automate

.scripts/co-sample "Add a Dev Container" \
  batch1 \
  .devcontainer/devcontainer.json \
  .github/dependabot.yml

💣 Not so lucky?

Hmm your PC may not have Docker setup correctly (next step...)

Footnotes

  1. copilot-setup-steps.yml is the workflow that Copilot looks for and runs when running in detached agentic mode.

  2. As of writing this in February 2026

  3. Command Palette shortcut
    Mac: ⬆⌘P (shift+command+P)
    Windows/Linux: ⬆^P (shift+ctrl+P)

Metadata

Metadata

Assignees

No one assigned

    Labels

    batch1Pulls from batch1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions