Examples
The examples/ directory in the crib repository contains working projects you can try directly:
git clone https://github.com/fgrehm/crib.gitcd crib/examples/simplecrib up && crib shellEach example below shows the key parts of the configuration. All examples are self-contained and ready to run.
Simple (base image only)
Section titled “Simple (base image only)”The minimal setup: a base image, no Dockerfile, no features.
{ "name": "simple", "image": "docker.io/library/debian:12-slim", "overrideCommand": true, "remoteUser": "root", "postCreateCommand": "echo '==> container ready'"}overrideCommand: true replaces the image’s default entrypoint with a long-running sleep, keeping the container alive for crib shell and crib exec.
Most of these examples use remoteUser: "root" for simplicity since the base images don’t ship a non-root user. The devcontainer base images (like the one in the Rust example) come with a vscode user preconfigured, which is what most projects use in practice.
Node.js
Section titled “Node.js”A Node.js project using the official Node image directly.
{ "name": "nodejs-project", "image": "docker.io/library/node:22-bookworm", "overrideCommand": true, "remoteUser": "root", "postCreateCommand": "apt-get update && apt-get install -y git make curl"}Python (custom Dockerfile)
Section titled “Python (custom Dockerfile)”When you need to install system packages or project dependencies at build time, use a Dockerfile.
{ "name": "python-dockerfile", "build": { "dockerfile": "Dockerfile", "context": "." }, "overrideCommand": true, "remoteUser": "root"}# examples/python-dockerfile/.devcontainer/DockerfileFROM docker.io/library/python:3.12-bookworm
RUN apt-get update && apt-get install -y \ git make curl build-essential \ && rm -rf /var/lib/apt/lists/*
WORKDIR /workspaces/python-dockerfile
RUN pip install --no-cache-dir pytest pytest-cov black flake8{ "name": "go-project", "image": "docker.io/library/golang:1.26-bookworm", "overrideCommand": true, "remoteUser": "root", "postCreateCommand": "apt-get update && apt-get install -y git make curl"}Ruby (with package cache)
Section titled “Ruby (with package cache)”Shows the package cache plugin caching bundler gems across rebuilds.
{ "name": "ruby-project", "image": "docker.io/library/ruby:3.3-bookworm", "overrideCommand": true, "remoteUser": "root", "postCreateCommand": "bundle install"}cache = bundlerThe bundler cache provider sets BUNDLE_PATH so gems are stored in a named Docker volume that survives rebuilds.
Rust (with cargo and apt cache)
Section titled “Rust (with cargo and apt cache)”Uses a Microsoft devcontainer base image with a non-root user and multiple cache providers.
{ "name": "rust-project", "image": "mcr.microsoft.com/devcontainers/rust:1", "remoteUser": "vscode", "postCreateCommand": "sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev && cargo fetch"}cache = cargo, aptNo overrideCommand needed here because the devcontainer base image already has a long-running entrypoint.
Docker Compose (multi-service)
Section titled “Docker Compose (multi-service)”A Node.js app with a Redis database, managed together by Docker Compose.
{ "name": "compose-app", "dockerComposeFile": "docker-compose.yml", "service": "app", "runServices": ["app", "db"], "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "overrideCommand": true, "remoteUser": "root", "remoteEnv": { "PROJECT_NAME": "${containerEnv:PROJECT}", "REDIS_URL": "redis://db:6379" }}services: app: image: docker.io/library/node:20-slim environment: NODE_ENV: development PROJECT: ${localWorkspaceFolderBasename} db: image: docker.io/library/redis:7-alpineKey points:
servicespecifies which container crib attaches to forshell,run, andexec.runServicescontrols which services start oncrib up.${localWorkspaceFolderBasename}is substituted by crib before passing to compose.${containerEnv:PROJECT}resolves against the running container’s environment.
DevContainer Features (remote)
Section titled “DevContainer Features (remote)”Install tools from the devcontainer features registry without touching a Dockerfile.
{ "name": "with-remote-features", "image": "docker.io/library/ubuntu:24.04", "features": { "ghcr.io/devcontainers/features/go:1": {}, "ghcr.io/devcontainers/features/node:1": {}, "ghcr.io/devcontainers/features/github-cli:1": {} }, "overrideCommand": true, "remoteUser": "root"}Features are OCI artifacts pulled from container registries. Pass options as key-value pairs in the feature object (e.g., "version": "20" for a specific Node version).
DevContainer Features (local)
Section titled “DevContainer Features (local)”Define project-specific features as local directories.
{ "name": "with-local-features", "image": "docker.io/library/ubuntu:24.04", "features": { "./features/node": {} }, "overrideCommand": true, "remoteUser": "root"}Local features are referenced with ./ paths relative to the .devcontainer/ directory. Each feature needs a devcontainer-feature.json and an install.sh script. See Authoring Features for details.