GuidesDownload

Guides

Claude Code in dev containers.

A dev container gives every session the same tools and keeps what Claude runs off your own machine. Here is how to put Claude Code in one, how to keep your login when the container is rebuilt, and how Mastlight runs sessions inside a container you already have.

Without Mastlight

  1. Add the Claude Code feature to your dev container

    Claude Code ships as a Dev Container Feature. Save this as .devcontainer/devcontainer.json in your repository, or add the features block to the file you have. Replace the image line with your project’s own base image, or remove it if you use a Dockerfile.

    {
      "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
      "features": {
        "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
      }
    }

    The version tag, :1.0, pins the feature’s install script, not Claude Code itself. The feature installs the latest Claude Code, and it updates itself inside the container.

  2. Rebuild the container

    In VS Code, open the Command Palette (Cmd Shift P on a Mac, Ctrl Shift P on Windows) and run Dev Containers: Rebuild Container. Other tools, such as GitHub Codespaces or the Dev Containers CLI, have their own rebuild action.

  3. Sign in inside the container

    Open a terminal in the rebuilt container, run claude and follow the sign-in prompt. If the browser finishes but the callback never reaches the container, copy the code the browser shows and paste it at the Paste code here if prompted prompt.

  4. Keep your login when the container is rebuilt

    By default the container’s home folder is thrown away on rebuild, so you would sign in again. Claude Code keeps its login and settings in ~/.claude, and its account details in a separate ~/.claude.json, so a volume on ~/.claude alone is not enough. Mount a named volume there and set CLAUDE_CONFIG_DIR to the same path. For a container whose user is node:

    "mounts": [
      "source=claude-code-config,target=/home/node/.claude,type=volume"
    ],
    "containerEnv": {
      "CLAUDE_CONFIG_DIR": "/home/node/.claude"
    }

    Use your container user’s own home folder in place of /home/node.

  5. Mind the permission flag

    A container limits what a session can touch, but it is not a perfect wall. Claude Code’s docs warn that with --dangerously-skip-permissions, a malicious project can still send out anything reachable inside the container, including the credentials in ~/.claude. Use that only on repositories you trust, and avoid mounting secrets such as ~/.ssh into the container.

How Mastlight does it

Keys

Already have a dev container? You do not change it, and Mastlight does not add anything to your project.

What does not work yet

On Windows

Mastlight for Windows understands Docker Desktop’s folder forms, such as C:\project and /run/desktop/mnt/host/c/project. That is covered by unit tests and has not been run on a real Windows PC yet. Folders inside WSL (\\wsl$\ and \\wsl.localhost\) are not supported: the New session row says so. Dev container support arrived in Mastlight 1.0.10 on the Mac; the first Windows release is 1.1.2, an early preview.

Try Mastlight

Free, early preview, runs on your computer, no account with us.

Version 1.1.2 · macOS 13 or later, Apple silicon · 147.6 MB

Version 1.1.2 · Windows 10 or 11 · 123.7 MB · Arm build

Version 1.1.2 · Windows 10 or 11 · 116.8 MB · Intel or AMD build

First open is a little unusual because the app is not signed yet: getting started walks through it on each system.

Where these facts come from

Checked against the docs on 11 October 2026. Mastlight needs Claude Code 2.1.85 or newer; where a feature came later, this page says so.

More guides