| Filename | Latest commit message | Latest commit date |
|---|---|---|
| devcontainer.json | ||
| README.md | ||
dcc-devcontainer
One dev container for a workspace root — a plain directory holding one or
more git repos. Clone this repo into any directory as .devcontainer/, open
it, and its contents appear under /workspace:
<workspace-root>/ # opened in the container
├── .devcontainer/ # this folder
├── text-mate-frontend/ # → /workspace/text-mate-frontend
└── text-mate-backend/ # → /workspace/text-mate-backend
One container, one VS Code window, both apps. Each project's tools come from
its own mise.toml — nothing project-specific is baked in here.
Quick start
git clone https://github.com/DCC-BS/dcc-devcontainer.git <workspace-root>/.devcontainer
devcontainer up --workspace-folder <workspace-root> # or: VS Code → "Reopen in Container"
devcontainer exec --workspace-folder <workspace-root> zsh
Dotfiles (optional, set before devcontainer up — they apply only at
container create): add a dotfiles block to devcontainer.json. The repo is
cloned inside the container (private ones work — your SSH agent is forwarded)
and the install command runs once:
"dotfiles": {
"repository": "your-name/dotfiles",
"targetPath": "~/dotfiles", // default
"installCommand": "~/dotfiles/install.sh" // this default is used if the repo has install.sh
}
Changed your dotfiles later? Re-apply by recreating:
devcontainer up --workspace-folder <workspace-root> --remove-existing-container.
In VS Code: open the workspace root, F1 → Dev Containers: Reopen in
Container. Browser access to dev servers runs through VS Code port
auto-forward (no forwardPorts list needed) — devcontainer exec shells
don't see that forwarding, so run dev servers in a VS Code-attached terminal
when you need browser access.
Tooling: mise, lazily
| Event | What happens |
|---|---|
devcontainer up (create) |
mise trust --all walks /workspace and trusts every mise.toml (skips node_modules, respects .gitignore) |
first cd into a project |
missing tools auto-install (MISE_AUTO_INSTALL=true), then the project's postinstall hook runs (bun install / uv sync / Playwright browsers) |
| first shell | project enter hook reminds you to mise r pass-login if pass-cli isn't logged in |
One pass-cli login covers every project in the workspace.
Git credentials
SSH (the primary path): the host agent socket is bind-mounted to
/ssh-agent, and SSH_AUTH_SOCK points there in both containerEnv (covers
devcontainer exec / docker exec shells) and remoteEnv (covers VS Code
processes). Keys never leave the host. GitHub host keys are pre-seeded by
postCreateCommand (ssh-keyscan) — without that, the first SSH git
operation dies on the interactive host-key prompt.
- The agent socket must exist at
devcontainer upcreate time. - An agent restart replaces the socket inode — recreate the container.
- No agent running on the host (
SSH_AUTH_SOCKunset)?devcontainer upfails at create time withinvalid argument "source=,target=/ssh-agent,type=bind" for "--mount" flag: invalid value for 'source': value is empty. Start one first:eval "$(ssh-agent -s)" && ssh-add, then rerun.
HTTPS: for private HTTPS repos, use the SSH remote instead, or once per
container: gh auth login && gh auth setup-git.
Identity (user.name, user.email) comes from the mounted ~/.gitconfig.
Do I need to copy ~/.ssh into the container?
No. The private key stays on the host — the container signs through the mounted agent socket. Host keys for GitHub are seeded at create time.
If you later add non-GitHub SSH remotes, mount just known_hosts (read-only,
no keys):
"source=${localEnv:HOME}/.ssh/known_hosts,target=/root/.ssh/known_hosts,type=bind,readonly"
Project-specific extras
Not baked in (this file stays generic). Per project, consider adding:
remoteEnvfor host-side paths — e.g. cache dirs, sodocker composebind sources resolve host-side (the daemon runs on the host;$HOMEin the container is/root).customizations.vscodeextension lists.