Skip to content

DevContainers

Podman containers with custom development environments for VSCodium using DevPod and 3timeslazy.vscodium-devpodcontainers extension.

Create your own

The definition of the devpod is done in the folder .devcontainer with the file devcontainer.json. In this folder there can be other files like scripts or Dockerfile/docker-compose.yml.

To create the absolute bare minimum DevPod you need to: 1. Define it in .devcontainer/devcontainer.json. Not all images will work out of box.

.devcontainer/devcontainer.json
---
{
    "name": "boringproblem",
    "image": "python:3.13-trixie",
    "remoteUser": "root"
}
  1. In VSCodium open the Command Palette and select DevPod Containers: Open in Container.
  2. The container will be built and the workspace will reopen inside the DevPod.

I had to remove ForwardAgent yes from ~/.ssh/config on the newly added entry at the top because I do not have the ssh agent running by default.


Create an advanced image

The creators of Devcontainers offer some nice features with basic functionality to get started quickly.

.devcontainer/devcontainer.json
---
{
    "name": "boringproblem",
    "build": {
        "dockerfile": "./Dockerfile",
        "context": "."
    },
    "features": {
        "ghcr.io/devcontainers/features/common-utils:2": {
            "installZsh": "true",
            "username": "boringproblem",
            "userUid": "1000",
            "userGid": "1000",
            "upgradePackages": "true"
        }
    },
    "customizations": {
        "vscodium": {
            "extensions": {
                "ms-python.python": {}
            }
        }
    },
    "postCreateCommand": "bash ./.devcontainer/post_create.sh",
    "remoteUser": "boringproblem"
}

Create a Dockerfile to create a custom image. This example is a little silly because the feature defined in devcontainer.json (ghcr.io/devcontainers/features/common-utils:2) will create the user.

.devcontainer/Dockerfile
---
FROM python:3.13-trixie
RUN apt update && apt upgrade && apt install -y curl git bash
RUN useradd -m -s /bin/bash boringproblem
USER boringproblem

Create a script to run after creation inside the DevPod.

.devcontainer/post_create.sh
---
#!/usr/bin/env sh

## Your custom script goes here ...

Open the workspace in a DevPod from VSCodium and it will build the image and create the container.


Examples

Future work

Nix in devcontainers https://mischavandenburg.com/zet/installing-packages-in-devcontainers-with-nix/