Development containers
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -44,7 +44,7 @@
What you see at the authentication prompt depends on your provider:
* **Anthropic** : sign in through a browser with your Claude or Anthropic Console account
- * **[Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/third-party-integrations>)** : Claude Code uses your cloud provider credentials, with no browser prompt
+ * **[Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/third-party-integrations>)** : Claude Code uses your cloud provider credentials
For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud’s workload identity rather than mounting credential files from the host. See [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>) for the credential chain Claude Code reads. See [Choose your API provider](</docs/en/admin-setup#choose-your-api-provider>) to decide which path fits your organization.
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -71,7 +71,7 @@
## Enforce organization policy
-A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#settings-precedence>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
+A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#settings-precedence>). Copy the file into place from your Dockerfile:
Dockerfile
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -6,11 +6,7 @@
A dev container runs as a Docker container, either on your machine or on a cloud host such as GitHub Codespaces. An editor that supports the Dev Containers spec, such as VS Code, GitHub Codespaces, a JetBrains IDE, or Cursor, connects to that container: you browse and edit files in the editor as usual, but the integrated terminal, language servers, and build tools all run inside the container rather than on your host. Editors without dev container support, such as plain Vim, are not part of this workflow.Claude Code runs inside the container, so it sees the same files, dependencies, and tools as the rest of your project’s toolchain. In VS Code you can use either the [Claude Code extension panel](</docs/en/vs-code>) or run `claude` in the integrated terminal; both run inside the container and share the same `~/.claude` configuration.
-##
-
-
-
-Add Claude Code to your dev container
+## Add Claude Code to your dev container
Claude Code installs into any dev container through the [Claude Code Dev Container Feature](<https://github.com/anthropics/devcontainer-features/tree/main/src/claude-code>). The settings work with any tool that supports the Dev Containers spec, such as VS Code, GitHub Codespaces, or JetBrains IDEs. The steps below use VS Code as an example. When you open the container in VS Code or Codespaces, the feature also adds the Claude Code VS Code extension; other editors ignore that part.
@@ -54,11 +50,7 @@
For the Anthropic sign-in: if no browser opens, or it signs you in and then shows a `localhost` connection error, use the login URL shown above the terminal’s paste prompt. Copy it into your browser, sign in there, then paste the code the browser shows into that prompt. If pasting does nothing, see [OAuth login fails in WSL2, SSH, or containers](</docs/en/troubleshoot-install#oauth-login-fails-in-wsl2-ssh-or-containers>).
-##
-
-
-
-Persist authentication and settings across rebuilds
+## Persist authentication and settings across rebuilds
By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your account details, personal MCP servers, and per-project trust in a separate file outside that directory: [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>). To keep the directory and the file, mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
@@ -77,11 +69,7 @@
To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically.
-##
-
-
-
-Enforce organization policy
+## Enforce organization policy
A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#settings-precedence>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
@@ -101,27 +89,15 @@
`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) depend on, so sessions in the container can’t use them. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` to `1` in `containerEnv`. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
-##
-
-
-
-Restrict network egress
+## Restrict network egress
You can limit the container’s outbound traffic to only the domains Claude Code needs. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the inference and authentication domains, and [Telemetry services](</docs/en/data-usage#telemetry-services>) for the optional telemetry and error reporting connections and how to disable them. The reference container includes an [`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>) script that limits outbound traffic to the destinations the script allows. Running a firewall inside a container requires extra permissions, so the reference adds the `NET_ADMIN` and `NET_RAW` capabilities through `runArgs`. The firewall script and these capabilities are not required for Claude Code itself: you can leave them out and rely on your own network controls instead.
-##
-
-
-
-Run without permission prompts
+## Run without permission prompts
Because the container runs Claude Code as a non-root user and confines command execution to the container, you can pass `--dangerously-skip-permissions` for unattended operation. The CLI rejects this flag when launched as root, so confirm `remoteUser` is set to a non-root account. Skipping permission prompts removes your opportunity to review tool calls before they run. Claude can still modify any file in the bind-mounted workspace, which appears directly on your host, and reach anything the container’s network policy allows. Pair this flag with the network egress restrictions above to limit what a bypassed session can reach. If you want fewer prompts without disabling safety checks, consider [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) instead, which has a classifier review actions before they run. To prevent engineers from using `--dangerously-skip-permissions` at all, set `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/settings-reference#permission-settings>).
-##
-
-
-
-Try the reference container
+## Try the reference container
The [`anthropics/claude-code`](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository includes an example dev container that combines the CLI, the egress firewall, persistent volumes, and a Zsh-based shell. It is provided as a working example rather than a maintained base image; use it to see how the pieces fit together before applying them to your own configuration.
@@ -157,11 +133,7 @@
[`Dockerfile`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>)| Base image, development tools, and the Claude Code install
[`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>)| Limits outbound network traffic to the destinations the script allows
-##
-
-
-
-Next steps
+## Next steps
Once Claude Code is running in your dev container, the pages below cover the rest of an organization rollout: choosing an authentication path, delivering managed policy outside the repository, monitoring usage, and understanding what Claude Code stores and sends.
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -52,7 +52,7 @@
For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud’s workload identity rather than mounting credential files from the host. See [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>) for the credential chain Claude Code reads. See [Choose your API provider](</docs/en/admin-setup#choose-your-api-provider>) to decide which path fits your organization.
-If the browser sign-in completes but the callback never reaches the container, copy the code shown in the browser and paste it at the `Paste code here if prompted` prompt in the terminal. This can happen when the editor’s port forwarding doesn’t route the localhost callback.
+For the Anthropic sign-in: if no browser opens, or it signs you in and then shows a `localhost` connection error, use the login URL shown above the terminal’s paste prompt. Copy it into your browser, sign in there, then paste the code the browser shows into that prompt. If pasting does nothing, see [OAuth login fails in WSL2, SSH, or containers](</docs/en/troubleshoot-install#oauth-login-fails-in-wsl2-ssh-or-containers>).
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -60,7 +60,7 @@
Persist authentication and settings across rebuilds
-By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
+By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your account details, personal MCP servers, and per-project trust in a separate file outside that directory: [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>). To keep the directory and the file, mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
devcontainer.json
@@ -71,7 +71,11 @@
"CLAUDE_CONFIG_DIR": "/home/node/.claude"
}
-Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically.
+Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one.
+
+If Claude Code repeats first-launch setup after each rebuild despite the mounted volume, check that `containerEnv` in `devcontainer.json` sets `CLAUDE_CONFIG_DIR` to the volume’s mount path. Without `CLAUDE_CONFIG_DIR`, `~/.claude.json` stays in the home directory and is discarded on rebuild, along with its record that you completed setup.
+
+To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically.
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -95,7 +95,7 @@
"DISABLE_AUTOUPDATER": "1"
}
-`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) depend on, so sessions in the container can’t use them. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) depend on, so sessions in the container can’t use them. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` to `1` in `containerEnv`. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
@@ -162,7 +162,7 @@
Once Claude Code is running in your dev container, the pages below cover the rest of an organization rollout: choosing an authentication path, delivering managed policy outside the repository, monitoring usage, and understanding what Claude Code stores and sends.
* [Set up Claude Code for your organization](</docs/en/admin-setup>): choose an authentication provider, decide how policy reaches devices, and plan the rollout
- * [Server-managed settings](</docs/en/server-managed-settings>): deliver managed policy from the Claude.ai admin console so engineers cannot bypass it by editing repository files
+ * [Server-managed settings](</docs/en/server-managed-settings>): deliver managed policy from the claude.ai admin console so engineers cannot bypass it by editing repository files
* [Monitor usage and audit activity](</docs/en/monitoring-usage>): export OpenTelemetry metrics and review what your team is running
* [Network access requirements](</docs/en/network-config#network-access-requirements>): the full domain allowlist for proxies and firewalls
* [Telemetry services and opt-out](</docs/en/data-usage#telemetry-services>): what Claude Code sends by default and the environment variables that disable it
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -103,7 +103,7 @@
Restrict network egress
-You can limit the container’s outbound traffic to only the domains Claude Code needs. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the inference and authentication domains, and [Telemetry services](</docs/en/data-usage#telemetry-services>) for the optional telemetry and error reporting connections and how to disable them. The reference container includes an [`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>) script that blocks all outbound traffic except the domains Claude Code and your development tools need. Running a firewall inside a container requires extra permissions, so the reference adds the `NET_ADMIN` and `NET_RAW` capabilities through `runArgs`. The firewall script and these capabilities are not required for Claude Code itself: you can leave them out and rely on your own network controls instead.
+You can limit the container’s outbound traffic to only the domains Claude Code needs. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the inference and authentication domains, and [Telemetry services](</docs/en/data-usage#telemetry-services>) for the optional telemetry and error reporting connections and how to disable them. The reference container includes an [`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>) script that limits outbound traffic to the destinations the script allows. Running a firewall inside a container requires extra permissions, so the reference adds the `NET_ADMIN` and `NET_RAW` capabilities through `runArgs`. The firewall script and these capabilities are not required for Claude Code itself: you can leave them out and rely on your own network controls instead.
##
@@ -151,7 +151,7 @@
---|---
[`devcontainer.json`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>)| Volume mounts, `runArgs` capabilities, VS Code extensions, and `containerEnv`
[`Dockerfile`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>)| Base image, development tools, and the Claude Code install
-[`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>)| Blocks all outbound network traffic except the allowed domains
+[`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>)| Limits outbound network traffic to the destinations the script allows
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -60,7 +60,7 @@
Persist authentication and settings across rebuilds
-By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
+By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings-reference#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
devcontainer.json
@@ -79,14 +79,14 @@
Enforce organization policy
-A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
+A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#settings-precedence>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
Dockerfile
RUN mkdir -p /etc/claude-code
COPY managed-settings.json /etc/claude-code/managed-settings.json
-Because the Dockerfile lives in the repository, anyone with write access can change or remove this step. For policy that engineers cannot bypass by editing repository files, deliver managed settings through [server-managed settings](</docs/en/server-managed-settings>) or your MDM instead. See [managed settings files](</docs/en/settings#settings-files>) for the available keys and the other delivery paths. To set [environment variables](</docs/en/env-vars>) that apply to every Claude Code session in the container, add them to `containerEnv` in your `devcontainer.json`. The following example opts out of telemetry and error reporting and prevents Claude Code from auto-updating after install:
+Because the Dockerfile lives in the repository, anyone with write access can change or remove this step. For policy that engineers cannot bypass by editing repository files, deliver managed settings through [server-managed settings](</docs/en/server-managed-settings>) or your MDM instead. See [managed settings files](</docs/en/managed-settings#delivery-mechanisms>) for the available keys and the other delivery paths. To set [environment variables](</docs/en/env-vars>) that apply to every Claude Code session in the container, add them to `containerEnv` in your `devcontainer.json`. The following example opts out of telemetry and error reporting and prevents Claude Code from auto-updating after install:
devcontainer.json
@@ -111,7 +111,7 @@
Run without permission prompts
-Because the container runs Claude Code as a non-root user and confines command execution to the container, you can pass `--dangerously-skip-permissions` for unattended operation. The CLI rejects this flag when launched as root, so confirm `remoteUser` is set to a non-root account. Skipping permission prompts removes your opportunity to review tool calls before they run. Claude can still modify any file in the bind-mounted workspace, which appears directly on your host, and reach anything the container’s network policy allows. Pair this flag with the network egress restrictions above to limit what a bypassed session can reach. If you want fewer prompts without disabling safety checks, consider [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) instead, which has a classifier review actions before they run. To prevent engineers from using `--dangerously-skip-permissions` at all, set `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/settings#permission-settings>).
+Because the container runs Claude Code as a non-root user and confines command execution to the container, you can pass `--dangerously-skip-permissions` for unattended operation. The CLI rejects this flag when launched as root, so confirm `remoteUser` is set to a non-root account. Skipping permission prompts removes your opportunity to review tool calls before they run. Claude can still modify any file in the bind-mounted workspace, which appears directly on your host, and reach anything the container’s network policy allows. Pair this flag with the network egress restrictions above to limit what a bypassed session can reach. If you want fewer prompts without disabling safety checks, consider [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) instead, which has a classifier review actions before they run. To prevent engineers from using `--dangerously-skip-permissions` at all, set `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/settings-reference#permission-settings>).
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -79,7 +79,7 @@
Enforce organization policy
-A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Copy the file into place from your Dockerfile:
+A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
Dockerfile
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -95,7 +95,7 @@
"DISABLE_AUTOUPDATER": "1"
}
-`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) depend on, so sessions in the container can’t use either. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and the other [features that need feature-flag fetching](</docs/en/env-vars#features-that-need-feature-flag-fetching>) depend on, so sessions in the container can’t use them. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -95,7 +95,7 @@
"DISABLE_AUTOUPDATER": "1"
}
-`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) depends on, so sessions in the container can’t use Remote Control. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) and [cross-session messaging](</docs/en/cross-session-messaging#availability>) depend on, so sessions in the container can’t use either. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -79,7 +79,7 @@
Enforce organization policy
-A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
+A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory, apart from the exceptions under [Settings precedence](</docs/en/settings#settings-precedence>). Copy the file into place from your Dockerfile:
Dockerfile
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -31,7 +31,7 @@
}
}
-Replace the `image` line with your project’s base image or remove it if your existing file uses a Dockerfile.
+Replace the `image` line with your project’s base image or remove it if your existing file uses a Dockerfile.The Claude Code feature installs Node.js itself when the base image doesn’t provide it. If that install fails and the build stops with `Failed to install Node.js and npm`, add `"ghcr.io/devcontainers/features/node:1": {}` to the `features` block above the Claude Code feature and rebuild.
2
@@ -60,15 +60,18 @@
Persist authentication and settings across rebuilds
-By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under [`~/.claude`](</docs/en/claude-directory>). Mount a named volume at that path to keep this state across rebuilds. The following example mounts a volume at the home directory of the `node` user:
+By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under the [`~/.claude`](</docs/en/claude-directory>) directory. It stores your OAuth account, personal MCP servers, and per-project trust in [`~/.claude.json`](</docs/en/settings#global-config-settings>), a separate file outside that directory, so mounting a volume at `~/.claude` alone doesn’t keep you signed in. Mount a named volume at `~/.claude` and set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the same path so Claude Code writes `.claude.json` inside the volume. The following example mounts the volume and sets `CLAUDE_CONFIG_DIR` for a container whose `remoteUser` is `node`:
devcontainer.json
"mounts": [
"source=claude-code-config,target=/home/node/.claude,type=volume"
- ]
+ ],
+ "containerEnv": {
+ "CLAUDE_CONFIG_DIR": "/home/node/.claude"
+ }
-Replace `/home/node` with the home directory of your container’s `remoteUser`. If you mount the volume somewhere other than `~/.claude`, set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the mount path so Claude Code reads and writes there. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists across stopping and starting a codespace, but is still cleared when you rebuild the container, so the volume mount above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>); Codespaces makes secrets available as environment variables inside the container automatically.
+Replace `/home/node` with the home directory of your container’s `remoteUser`. If you already set `containerEnv`, for example in Enforce organization policy, add `CLAUDE_CONFIG_DIR` to that object rather than adding a second one. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists when you stop and start a codespace but is cleared when you rebuild the container, so the configuration above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>). Codespaces exposes secrets as environment variables inside the container automatically.
##
@@ -92,7 +95,7 @@
"DISABLE_AUTOUPDATER": "1"
}
-The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` also disables the feature-flag evaluation that [Remote Control](</docs/en/remote-control#requirements>) depends on, so sessions in the container can’t use Remote Control. The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -48,9 +48,9 @@
What you see at the authentication prompt depends on your provider:
* **Anthropic** : sign in through a browser with your Claude or Anthropic Console account
- * **[Amazon Bedrock, Google Vertex AI, or Microsoft Foundry](</docs/en/third-party-integrations>)** : Claude Code uses your cloud provider credentials, with no browser prompt
+ * **[Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry](</docs/en/third-party-integrations>)** : Claude Code uses your cloud provider credentials, with no browser prompt
-For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud’s workload identity rather than mounting credential files from the host. See [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Vertex AI](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>) for the credential chain Claude Code reads. See [Choose your API provider](</docs/en/admin-setup#choose-your-api-provider>) to decide which path fits your organization.
+For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud’s workload identity rather than mounting credential files from the host. See [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Cloud’s Agent Platform](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>) for the credential chain Claude Code reads. See [Choose your API provider](</docs/en/admin-setup#choose-your-api-provider>) to decide which path fits your organization.
If the browser sign-in completes but the callback never reaches the container, copy the code shown in the browser and paste it at the `Paste code here if prompted` prompt in the terminal. This can happen when the editor’s port forwarding doesn’t route the localhost callback.
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -1,9 +1,4 @@
-A [development container](<https://containers.dev/>), or dev container, lets you define an identical, isolated environment that every engineer on your team can run. With Claude Code installed in that container, commands Claude runs execute inside it rather than on the host machine, while edits to your project files appear in your local repository as you work. This page covers installing Claude Code in a dev container and the configuration topics that follow. Each topic is self-contained, so jump to the ones that match what you need to set up:
-
- * Persist authentication and settings across rebuilds
- * Enforce organization policy
- * Restrict network egress
- * Run without permission prompts
+A [development container](<https://containers.dev/>), or dev container, lets you define an identical, isolated environment that every engineer on your team can run. With Claude Code installed in that container, commands Claude runs execute inside it rather than on the host machine, while edits to your project files appear in your local repository as you work. This page covers installing Claude Code in a dev container, then a set of self-contained configuration topics: persisting authentication across rebuilds, enforcing organization policy, restricting network egress, and running without permission prompts. Read the ones that match your setup.
While the dev container provides substantial protections, no system is completely immune to all attacks. When executed with `--dangerously-skip-permissions`, dev containers do not prevent a malicious project from exfiltrating anything accessible inside the container, including the Claude Code credentials stored in [`~/.claude`](</docs/en/claude-directory>). Only use dev containers when developing with trusted repositories, and monitor Claude’s activities. Avoid mounting host secrets such as `~/.ssh` or cloud credential files into the container; prefer repository-scoped or short-lived tokens.
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -1,9 +1,3 @@
-> ## Documentation Index
->
-> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
->
-> Use this file to discover all available pages before exploring further.
-
A [development container](<https://containers.dev/>), or dev container, lets you define an identical, isolated environment that every engineer on your team can run. With Claude Code installed in that container, commands Claude runs execute inside it rather than on the host machine, while edits to your project files appear in your local repository as you work. This page covers installing Claude Code in a dev container and the configuration topics that follow. Each topic is self-contained, so jump to the ones that match what you need to set up:
* Persist authentication and settings across rebuilds
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -175,5 +175,6 @@
* [Network access requirements](</docs/en/network-config#network-access-requirements>): the full domain allowlist for proxies and firewalls
* [Telemetry services and opt-out](</docs/en/data-usage#telemetry-services>): what Claude Code sends by default and the environment variables that disable it
* [Explore the `.claude` directory](</docs/en/claude-directory>): what the volume mount holds, including credentials, settings, and session history
+ * [Sandbox environments](</docs/en/sandbox-environments>): compare dev containers with the built-in Bash sandbox, custom containers, and VMs
* [Security model](</docs/en/security>): how Claude Code’s permission system, sandboxing, and prompt-injection protections fit together
* [Permission modes](</docs/en/permission-modes>): the full range from plan mode to auto mode to bypass, and when to use each
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -1,3 +1,9 @@
+> ## Documentation Index
+>
+> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt>
+>
+> Use this file to discover all available pages before exploring further.
+
A [development container](<https://containers.dev/>), or dev container, lets you define an identical, isolated environment that every engineer on your team can run. With Claude Code installed in that container, commands Claude runs execute inside it rather than on the host machine, while edits to your project files appear in your local repository as you work. This page covers installing Claude Code in a dev container and the configuration topics that follow. Each topic is self-contained, so jump to the ones that match what you need to set up:
* Persist authentication and settings across rebuilds
Show diff (228 lines)
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -1,108 +1,173 @@
-The reference [devcontainer setup](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) and associated [Dockerfile](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>) offer a preconfigured development container that you can use as is, or customize for your needs. This devcontainer works with the Visual Studio Code [Dev Containers extension](<https://code.visualstudio.com/docs/devcontainers/containers>) and similar tools. The container’s enhanced security measures (isolation and firewall rules) allow you to run `claude --dangerously-skip-permissions` to bypass permission prompts for unattended operation.
+A [development container](<https://containers.dev/>), or dev container, lets you define an identical, isolated environment that every engineer on your team can run. With Claude Code installed in that container, commands Claude runs execute inside it rather than on the host machine, while edits to your project files appear in your local repository as you work. This page covers installing Claude Code in a dev container and the configuration topics that follow. Each topic is self-contained, so jump to the ones that match what you need to set up:
-While the devcontainer provides substantial protections, no system is completely immune to all attacks. When executed with `--dangerously-skip-permissions`, devcontainers don’t prevent a malicious project from exfiltrating anything accessible in the devcontainer including Claude Code credentials. We recommend only using devcontainers when developing with trusted repositories. Always maintain good security practices and monitor Claude’s activities.
+ * Persist authentication and settings across rebuilds
+ * Enforce organization policy
+ * Restrict network egress
+ * Run without permission prompts
+
+While the dev container provides substantial protections, no system is completely immune to all attacks. When executed with `--dangerously-skip-permissions`, dev containers do not prevent a malicious project from exfiltrating anything accessible inside the container, including the Claude Code credentials stored in [`~/.claude`](</docs/en/claude-directory>). Only use dev containers when developing with trusted repositories, and monitor Claude’s activities. Avoid mounting host secrets such as `~/.ssh` or cloud credential files into the container; prefer repository-scoped or short-lived tokens.
+
+How dev containers work with your editor
+
+A dev container runs as a Docker container, either on your machine or on a cloud host such as GitHub Codespaces. An editor that supports the Dev Containers spec, such as VS Code, GitHub Codespaces, a JetBrains IDE, or Cursor, connects to that container: you browse and edit files in the editor as usual, but the integrated terminal, language servers, and build tools all run inside the container rather than on your host. Editors without dev container support, such as plain Vim, are not part of this workflow.Claude Code runs inside the container, so it sees the same files, dependencies, and tools as the rest of your project’s toolchain. In VS Code you can use either the [Claude Code extension panel](</docs/en/vs-code>) or run `claude` in the integrated terminal; both run inside the container and share the same `~/.claude` configuration.
##
-Key features
+Add Claude Code to your dev container
- * **Production-ready Node.js** : Built on Node.js 20 with essential development dependencies
- * **Security by design** : Custom firewall restricting network access to only necessary services
- * **Developer-friendly tools** : Includes git, ZSH with productivity enhancements, fzf, and more
- * **Seamless VS Code integration** : Pre-configured extensions and optimized settings
- * **Session persistence** : Preserves command history and configurations between container restarts
- * **Works everywhere** : Compatible with macOS, Windows, and Linux development environments
+Claude Code installs into any dev container through the [Claude Code Dev Container Feature](<https://github.com/anthropics/devcontainer-features/tree/main/src/claude-code>). The settings work with any tool that supports the Dev Containers spec, such as VS Code, GitHub Codespaces, or JetBrains IDEs. The steps below use VS Code as an example. When you open the container in VS Code or Codespaces, the feature also adds the Claude Code VS Code extension; other editors ignore that part.
+
+New to dev containers? The [VS Code Dev Containers tutorial](<https://code.visualstudio.com/docs/devcontainers/tutorial>) walks through installing Docker, the extension, and opening your first container. For a fuller hardened example with a firewall and persistent volumes, see Try the reference container.
+
+1
+
+Create or update devcontainer.json
+
+Save the following as `.devcontainer/devcontainer.json` in your repository, or add the `features` block to your existing file.The version tag at the end, such as `:1.0`, pins the feature’s install script, not the Claude Code release. The feature installs the latest Claude Code, and Claude Code auto-updates itself inside the container by default.To pin the CLI version or disable auto-update, see Enforce organization policy.
+
+.devcontainer/devcontainer.json
+
+ {
+ "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
+ "features": {
+ "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}
+ }
+ }
+
+Replace the `image` line with your project’s base image or remove it if your existing file uses a Dockerfile.
+
+2
+
+Rebuild the container
+
+Open the VS Code Command Palette with `Cmd+Shift+P` on Mac or `Ctrl+Shift+P` on Windows and Linux, and run **Dev Containers: Rebuild Container**.For other tools, follow that tool’s rebuild action: see [rebuilding in GitHub Codespaces](<https://docs.github.com/en/codespaces/developing-in-a-codespace/rebuilding-the-container-in-a-codespace>), the [Dev Containers CLI](<https://github.com/devcontainers/cli>), or your IDE’s dev container documentation.
+
+3
+
+Sign in to Claude Code
+
+Open a terminal in the rebuilt container and run `claude`, then follow the authentication prompt.
+
+What you see at the authentication prompt depends on your provider:
+
+ * **Anthropic** : sign in through a browser with your Claude or Anthropic Console account
+ * **[Amazon Bedrock, Google Vertex AI, or Microsoft Foundry](</docs/en/third-party-integrations>)** : Claude Code uses your cloud provider credentials, with no browser prompt
+
+For cloud providers, pass credentials into the container as environment variables through `containerEnv`, a Codespaces secret, or your cloud’s workload identity rather than mounting credential files from the host. See [Amazon Bedrock](</docs/en/amazon-bedrock>), [Google Vertex AI](</docs/en/google-vertex-ai>), or [Microsoft Foundry](</docs/en/microsoft-foundry>) for the credential chain Claude Code reads. See [Choose your API provider](</docs/en/admin-setup#choose-your-api-provider>) to decide which path fits your organization.
+
+If the browser sign-in completes but the callback never reaches the container, copy the code shown in the browser and paste it at the `Paste code here if prompted` prompt in the terminal. This can happen when the editor’s port forwarding doesn’t route the localhost callback.
##
-Getting started in 4 steps
+Persist authentication and settings across rebuilds
- 1. Install VS Code and the [Dev Containers extension](<https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers>)
- 2. Clone the [Claude Code reference implementation](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository
- 3. Open the repository in VS Code
- 4. When prompted, click “Reopen in Container” (or use Command Palette: Cmd+Shift+P → “Dev Containers: Reopen in Container”)
+By default, the container’s home directory is discarded on rebuild, so engineers must sign in again each time. Claude Code stores its authentication token, user settings, and session history under [`~/.claude`](</docs/en/claude-directory>). Mount a named volume at that path to keep this state across rebuilds. The following example mounts a volume at the home directory of the `node` user:
-Once the container finishes building, open a terminal in VS Code with `Ctrl+`` and run `claude` to authenticate and start your first session. The container has Claude Code preinstalled, so you can begin working immediately. Your project files are mounted into the container, and any code Claude writes appears in your local repository.
+devcontainer.json
+
+ "mounts": [
+ "source=claude-code-config,target=/home/node/.claude,type=volume"
+ ]
+
+Replace `/home/node` with the home directory of your container’s `remoteUser`. If you mount the volume somewhere other than `~/.claude`, set [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars>) to the mount path so Claude Code reads and writes there. To isolate state per project rather than sharing one volume across all repositories, include the `${devcontainerId}` variable in the source name. The [reference configuration](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>) uses `source=claude-code-config-${devcontainerId}` for this purpose. In GitHub Codespaces, `~/.claude` persists across stopping and starting a codespace, but is still cleared when you rebuild the container, so the volume mount above applies there too. To carry authentication across codespaces, store `ANTHROPIC_API_KEY` or a `CLAUDE_CODE_OAUTH_TOKEN` from [`claude setup-token`](</docs/en/authentication#generate-a-long-lived-token>) as a [Codespaces secret](<https://docs.github.com/en/codespaces/managing-your-codespaces/managing-your-account-specific-secrets-for-github-codespaces>); Codespaces makes secrets available as environment variables inside the container automatically.
##
-Configuration breakdown
+Enforce organization policy
-The devcontainer setup consists of three primary components:
+A dev container is a convenient place to apply organization policy, because the same image and configuration run on every engineer’s machine. Claude Code reads `/etc/claude-code/managed-settings.json` on Linux and applies it at the highest precedence in the [settings hierarchy](</docs/en/settings#how-scopes-interact>), so values there override anything an engineer sets in `~/.claude` or the project’s `.claude/` directory. Copy the file into place from your Dockerfile:
- * [**devcontainer.json**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>): Controls container settings, extensions, and volume mounts
- * [**Dockerfile**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>): Defines the container image and installed tools
- * [**init-firewall.sh**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>): Establishes network security rules
+Dockerfile
+
+ RUN mkdir -p /etc/claude-code
+ COPY managed-settings.json /etc/claude-code/managed-settings.json
+
+Because the Dockerfile lives in the repository, anyone with write access can change or remove this step. For policy that engineers cannot bypass by editing repository files, deliver managed settings through [server-managed settings](</docs/en/server-managed-settings>) or your MDM instead. See [managed settings files](</docs/en/settings#settings-files>) for the available keys and the other delivery paths. To set [environment variables](</docs/en/env-vars>) that apply to every Claude Code session in the container, add them to `containerEnv` in your `devcontainer.json`. The following example opts out of telemetry and error reporting and prevents Claude Code from auto-updating after install:
+
+devcontainer.json
+
+ "containerEnv": {
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
+ "DISABLE_AUTOUPDATER": "1"
+ }
+
+The Dev Container Feature always installs the latest Claude Code release. To pin a specific Claude Code version for reproducible builds, install it from your Dockerfile with `npm install -g @anthropic-ai/claude-code@X.Y.Z` instead of using the feature, and set `DISABLE_AUTOUPDATER` as shown above. For the full list of policy controls including permission rules, tool restrictions, and MCP server allowlists, see [Set up Claude Code for your organization](</docs/en/admin-setup>). To make [MCP servers](</docs/en/mcp>) available inside the container, define them at [project scope](</docs/en/mcp#mcp-installation-scopes>) in a `.mcp.json` file at the repository root so they are checked in alongside your dev container configuration. Install any binaries that local stdio servers depend on in your Dockerfile, and add remote server domains to your network allowlist.
##
-Security features
+Restrict network egress
-The container implements a multi-layered security approach with its firewall configuration:
-
- * **Precise access control** : Restricts outbound connections to whitelisted domains only (npm registry, GitHub, Claude API, etc.)
- * **Allowed outbound connections** : The firewall permits outbound DNS and SSH connections
- * **Default-deny policy** : Blocks all other external network access
- * **Startup verification** : Validates firewall rules when the container initializes
- * **Isolation** : Creates a secure development environment separated from your main system
+You can limit the container’s outbound traffic to only the domains Claude Code needs. See [Network access requirements](</docs/en/network-config#network-access-requirements>) for the inference and authentication domains, and [Telemetry services](</docs/en/data-usage#telemetry-services>) for the optional telemetry and error reporting connections and how to disable them. The reference container includes an [`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>) script that blocks all outbound traffic except the domains Claude Code and your development tools need. Running a firewall inside a container requires extra permissions, so the reference adds the `NET_ADMIN` and `NET_RAW` capabilities through `runArgs`. The firewall script and these capabilities are not required for Claude Code itself: you can leave them out and rely on your own network controls instead.
##
-Customization options
+Run without permission prompts
-The devcontainer configuration is designed to be adaptable to your needs:
-
- * Add or remove VS Code extensions based on your workflow
- * Modify resource allocations for different hardware environments
- * Adjust network access permissions
- * Customize shell configurations and developer tooling
+Because the container runs Claude Code as a non-root user and confines command execution to the container, you can pass `--dangerously-skip-permissions` for unattended operation. The CLI rejects this flag when launched as root, so confirm `remoteUser` is set to a non-root account. Skipping permission prompts removes your opportunity to review tool calls before they run. Claude can still modify any file in the bind-mounted workspace, which appears directly on your host, and reach anything the container’s network policy allows. Pair this flag with the network egress restrictions above to limit what a bypassed session can reach. If you want fewer prompts without disabling safety checks, consider [auto mode](</docs/en/permission-modes#eliminate-prompts-with-auto-mode>) instead, which has a classifier review actions before they run. To prevent engineers from using `--dangerously-skip-permissions` at all, set `permissions.disableBypassPermissionsMode` to `"disable"` in [managed settings](</docs/en/settings#permission-settings>).
##
-Example use cases
+Try the reference container
-###
+The [`anthropics/claude-code`](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository includes an example dev container that combines the CLI, the egress firewall, persistent volumes, and a Zsh-based shell. It is provided as a working example rather than a maintained base image; use it to see how the pieces fit together before applying them to your own configuration.
-
+1
-Secure client work
+Install prerequisites
-Use devcontainers to isolate different client projects, ensuring code and credentials never mix between environments.
+Install VS Code and the [Dev Containers extension](<https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers>).
-###
+2
-
+Clone the reference
-Team onboarding
+Clone the [Claude Code repository](<https://github.com/anthropics/claude-code>) and open it in VS Code.
-New team members can get a fully configured development environment in minutes, with all necessary tools and settings pre-installed.
+3
-###
+Reopen in container
-
+When prompted, click **Reopen in Container** , or run **Dev Containers: Reopen in Container** from the Command Palette.
-Consistent CI/CD environments
+4
-Mirror your devcontainer configuration in CI/CD pipelines to ensure development and production environments match.
+Start Claude Code
+
+Once the container finishes building, open a terminal with `Ctrl+`` and run `claude` to sign in and start your first session.
+
+To use this configuration with your own project, copy the `.devcontainer/` directory into your repository and adjust the Dockerfile for your toolchain, or return to Add Claude Code to your dev container to add only the feature to a setup you already have. The reference configuration consists of three files. None of them are required when you add Claude Code to your own dev container through the feature, but they show one way to combine the pieces.
+
+File| Purpose
+---|---
+[`devcontainer.json`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>)| Volume mounts, `runArgs` capabilities, VS Code extensions, and `containerEnv`
+[`Dockerfile`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>)| Base image, development tools, and the Claude Code install
+[`init-firewall.sh`](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>)| Blocks all outbound network traffic except the allowed domains
##
-Related resources
+Next steps
- * [VS Code devcontainers documentation](<https://code.visualstudio.com/docs/devcontainers/containers>)
- * [Claude Code security best practices](</docs/en/security>)
- * [Enterprise network configuration](</docs/en/network-config>)
+Once Claude Code is running in your dev container, the pages below cover the rest of an organization rollout: choosing an authentication path, delivering managed policy outside the repository, monitoring usage, and understanding what Claude Code stores and sends.
+
+ * [Set up Claude Code for your organization](</docs/en/admin-setup>): choose an authentication provider, decide how policy reaches devices, and plan the rollout
+ * [Server-managed settings](</docs/en/server-managed-settings>): deliver managed policy from the Claude.ai admin console so engineers cannot bypass it by editing repository files
+ * [Monitor usage and audit activity](</docs/en/monitoring-usage>): export OpenTelemetry metrics and review what your team is running
+ * [Network access requirements](</docs/en/network-config#network-access-requirements>): the full domain allowlist for proxies and firewalls
+ * [Telemetry services and opt-out](</docs/en/data-usage#telemetry-services>): what Claude Code sends by default and the environment variables that disable it
+ * [Explore the `.claude` directory](</docs/en/claude-directory>): what the volume mount holds, including credentials, settings, and session history
+ * [Security model](</docs/en/security>): how Claude Code’s permission system, sandboxing, and prompt-injection protections fit together
+ * [Permission modes](</docs/en/permission-modes>): the full range from plan mode to auto mode to bypass, and when to use each
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -25,6 +25,8 @@
2. Clone the [Claude Code reference implementation](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository
3. Open the repository in VS Code
4. When prompted, click “Reopen in Container” (or use Command Palette: Cmd+Shift+P → “Dev Containers: Reopen in Container”)
+
+Once the container finishes building, open a terminal in VS Code with `Ctrl+`` and run `claude` to authenticate and start your first session. The container has Claude Code preinstalled, so you can begin working immediately. Your project files are mounted into the container, and any code Claude writes appears in your local repository.
##
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -21,10 +21,10 @@
Getting started in 4 steps
- 1. Install VS Code and the Remote - Containers extension
+ 1. Install VS Code and the [Dev Containers extension](<https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers>)
2. Clone the [Claude Code reference implementation](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository
3. Open the repository in VS Code
- 4. When prompted, click “Reopen in Container” (or use Command Palette: Cmd+Shift+P → “Remote-Containers: Reopen in Container”)
+ 4. When prompted, click “Reopen in Container” (or use Command Palette: Cmd+Shift+P → “Dev Containers: Reopen in Container”)
##
Show diff (109 lines)
--- a/devcontainer.md
+++ b/devcontainer.md
@@ -0,0 +1,106 @@
+The reference [devcontainer setup](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) and associated [Dockerfile](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>) offer a preconfigured development container that you can use as is, or customize for your needs. This devcontainer works with the Visual Studio Code [Dev Containers extension](<https://code.visualstudio.com/docs/devcontainers/containers>) and similar tools. The container’s enhanced security measures (isolation and firewall rules) allow you to run `claude --dangerously-skip-permissions` to bypass permission prompts for unattended operation.
+
+While the devcontainer provides substantial protections, no system is completely immune to all attacks. When executed with `--dangerously-skip-permissions`, devcontainers don’t prevent a malicious project from exfiltrating anything accessible in the devcontainer including Claude Code credentials. We recommend only using devcontainers when developing with trusted repositories. Always maintain good security practices and monitor Claude’s activities.
+
+##
+
+
+
+Key features
+
+ * **Production-ready Node.js** : Built on Node.js 20 with essential development dependencies
+ * **Security by design** : Custom firewall restricting network access to only necessary services
+ * **Developer-friendly tools** : Includes git, ZSH with productivity enhancements, fzf, and more
+ * **Seamless VS Code integration** : Pre-configured extensions and optimized settings
+ * **Session persistence** : Preserves command history and configurations between container restarts
+ * **Works everywhere** : Compatible with macOS, Windows, and Linux development environments
+
+##
+
+
+
+Getting started in 4 steps
+
+ 1. Install VS Code and the Remote - Containers extension
+ 2. Clone the [Claude Code reference implementation](<https://github.com/anthropics/claude-code/tree/main/.devcontainer>) repository
+ 3. Open the repository in VS Code
+ 4. When prompted, click “Reopen in Container” (or use Command Palette: Cmd+Shift+P → “Remote-Containers: Reopen in Container”)
+
+##
+
+
+
+Configuration breakdown
+
+The devcontainer setup consists of three primary components:
+
+ * [**devcontainer.json**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/devcontainer.json>): Controls container settings, extensions, and volume mounts
+ * [**Dockerfile**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/Dockerfile>): Defines the container image and installed tools
+ * [**init-firewall.sh**](<https://github.com/anthropics/claude-code/blob/main/.devcontainer/init-firewall.sh>): Establishes network security rules
+
+##
+
+
+
+Security features
+
+The container implements a multi-layered security approach with its firewall configuration:
+
+ * **Precise access control** : Restricts outbound connections to whitelisted domains only (npm registry, GitHub, Claude API, etc.)
+ * **Allowed outbound connections** : The firewall permits outbound DNS and SSH connections
+ * **Default-deny policy** : Blocks all other external network access
+ * **Startup verification** : Validates firewall rules when the container initializes
+ * **Isolation** : Creates a secure development environment separated from your main system
+
+##
+
+
+
+Customization options
+
+The devcontainer configuration is designed to be adaptable to your needs:
+
+ * Add or remove VS Code extensions based on your workflow
+ * Modify resource allocations for different hardware environments
+ * Adjust network access permissions
+ * Customize shell configurations and developer tooling
+
+##
+
+
+
+Example use cases
+
+###
+
+
+
+Secure client work
+
+Use devcontainers to isolate different client projects, ensuring code and credentials never mix between environments.
+
+###
+
+
+
+Team onboarding
+
+New team members can get a fully configured development environment in minutes, with all necessary tools and settings pre-installed.
+
+###
+
+
+
+Consistent CI/CD environments
+
+Mirror your devcontainer configuration in CI/CD pipelines to ensure development and production environments match.
+
+##
+
+
+
+Related resources
+
+ * [VS Code devcontainers documentation](<https://code.visualstudio.com/docs/devcontainers/containers>)
+ * [Claude Code security best practices](</docs/en/security>)
+ * [Enterprise network configuration](</docs/en/network-config>)