microsoft / microsoft/vscode

Feature request: User-level default Docker volume mounts for Dev Containers

Open
#325,616 0 comments 0 reactions 1 assignee Claimed by @chrmarti View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Add support to devcontainers for user-level Docker runtime customisations (e.g. volumes, bind mounts, and `runArgs`) that are automatically merged into all Dev Containers, similar to devcontainer **Default Features** and **Default Extensions**.

## Example

```json
{
"dev.containers.defaultMounts": [
{
"source": "${env:HOME}/.claude",
"target": "/home/vscode/.claude"
}
]
}
```

or

```json
{
"dev.containers.defaultRunArgs": [
"--mount",
"type=bind,src=${env:HOME}/.claude,dst=/home/vscode/.claude"
]
}
```

## Justification

This would allow developers to add storage for personal tooling (e.g. AI agent harness, MCP configuration, SSH keys, Git configuration, etc.) without requiring repository changes such as committed Compose overrides or personal `devcontainer.json` files (which also do not allow for local devcontainer inheritance).

It enables a clean separation between:

- **Project configuration** (shared and committed)
- **Developer preferences** (local and user-specific)

avoiding unnecessary Git noise and preventing repositories from implicitly endorsing or requiring a particular AI agent or developer toolchain.

## Unsuitable solutions considered

- **Dotfiles**
- Useful for configuring the container *after* it starts, but cannot add Docker bind mounts or other runtime configuration.
- Do not solve persisting host-side state (e.g. `~/.claude`) into the container.

- **Docker Compose overrides**
- Require changes to the repository (`dockerComposeFile`) or maintaining a separate local `devcontainer.json`.
- If referenced by `devcontainer.json`, all contributors must have the override file present.
- Couples personal preferences to repository configuration.

- **Repository-local `devcontainer.json` / Compose modifications**
- Pollutes repositories with configuration for a specific developer's preferred tooling.
- Implies or encourages the use of a particular agent harness when projects should remain tool-agnostic.

- **Dev Container Features**
- Excellent for installing tools, but cannot inject arbitrary Docker runtime configuration such as bind mounts or `runArgs`.

- **Bootstrap Image**
- Only affects the temporary container used for cloning and inspection, not the final development container.

## Real-world example

Anthropic's guidance for persisting Claude Code authentication across Dev Container rebuilds recommends adding a bind mount to the project's Dev Container configuration:

```json
"mounts": [
"source=claude-code-config,target=/home/node/.claude,type=volume"
]
```

https://code.claude.com/docs/en/devcontainer#persist-authentication-and-settings-across-rebuilds

While this works, it requires repository-level configuration changes for what is fundamentally a personal development preference. This creates unnecessary Git churn and introduces tool-specific configuration into repositories that should remain neutral regarding developers' choice of AI agent or development tooling.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.