Dev Container Generator (devcontainer.json, Dockerfile and Compose)
Pick an image, Features, ports and commands: get a checked .devcontainer folder.
Try before you buy.
- Free preview: the generated files with the Features and lifecycle commands hidden, every check, and what each setting does.
- Locked until you unlock it: download and copy.
- Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment that never renews. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment that never renews.
Ways to unlock shows how to get the full result.
Printing this result is locked in the free preview.
Container
Editors show it when you open or switch containers.
Any image reference with a tag, such as node:24-trixie.
Relative to the .devcontainer folder, e.g. ../Dockerfile.
Separated by spaces; installed with apt-get (apk on Alpine).
Features
A reference from containers.dev/features, optionally followed by its options as JSON.
Editor
publisher.name, as on the extension’s Marketplace page. Suggested puts in the ones for the language you picked.
Ports
A number such as 3000, or service:port (postgres:5432) for another Compose service.
Lifecycle commands
Runs on your computer (the host), before the container is created, and again on later starts.
Runs inside the container right after it is first created.
Runs after onCreateCommand when new source content arrives while the container is created (prebuilds use it).
Runs once the container is created and assigned to you: installing dependencies is the usual job.
Runs every time the container starts.
Runs every time an editor attaches to the container.
Several lines run one after the other (joined with &&).
Environment variables
A name like PASSWORD, TOKEN, SECRET or KEY is written as ${localEnv:NAME}: the value then comes from your computer, not the repository.
Mounts
A volume keeps data across rebuilds; a bind mount shares a folder of your computer (write ${localEnv:HOME}, not ~).
User and host
Empty: the image’s own user.
Advanced
Your .devcontainer folder
Checks
What each setting does
| Property | Value | What it does |
|---|
Use it
- Unzip the folder in the root of your project, so you have
.devcontainer/devcontainer.json, and commit it. - VS Code: install the Dev Containers extension and run Dev Containers: Reopen in Container. GitHub: create a codespace from the repository.
- Command line:
devcontainer up --workspace-folder .with the@devcontainers/clipackage.
Locked in the free preview. Opens the ways to unlock this result.
Locked in the free preview. Batch runs unlock with a pass.
Locked in the free preview. Query results unlock with a pass.
About the Dev Container Generator (devcontainer.json, Dockerfile and Compose)
Describe the development environment of a project and get its .devcontainer folder: devcontainer.json, plus a Dockerfile and a docker-compose.yml when the setup needs them. VS Code’s Dev Containers extension, GitHub Codespaces, JetBrains IDEs and the devcontainer command line all open the same folder, so everyone who works on the project gets the same tools in seconds.
Start from an official dev container image — Node.js, TypeScript, Python, Java, Go, .NET, PHP, Ruby, Rust, C++, plain Debian, Ubuntu or Alpine — or an image or Dockerfile of your own, or a Docker Compose setup with PostgreSQL, MySQL, MariaDB, Redis or MongoDB. Add official Dev Container Features (Docker in Docker, the GitHub, AWS and Azure command lines, kubectl and Helm, Terraform, more Node.js or Python versions…), editor extensions and settings, forwarded ports with labels, lifecycle commands such as postCreateCommand, environment variables, mounts, the user and the host’s minimum CPUs and memory.
Every value is checked as you type, the file is checked against the official devcontainer.json schema, and a table explains what each property does. Without a pass the result is a free preview: the files with their Features and lifecycle commands hidden, every check and the explanations; copying the files and the ZIP unlock with a Pro pass.
How to use it
- Choose how the container starts: a prebuilt image, a Dockerfile from that image (to add operating system packages), your own Dockerfile, or Docker Compose with databases.
- Pick the language and its version, then tick Features and set their options.
- Add editor extensions, ports to forward, the commands to run (
postCreateCommandinstalls dependencies) and environment variables; open the other sections for mounts, the user and the host’s requirements. - Read the checks under the files: errors must be fixed, warnings are likely mistakes, notes explain a choice.
- With a Pro pass, download the ZIP (or copy each file) and unzip it in the root of your project; without one the page shows the free preview. Then open the project in your editor and reopen it in the container.
Examples
Prebuilt image · Python 3.14 · Debian 13 (trixie) · Docker in Docker · port 8000 · postCreateCommand: pip install --user -r requirements.txt
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/python:3-3.14-trixie",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:4": {}
},
"forwardPorts": [8000],
"postCreateCommand": "pip install --user -r requirements.txt"
}Docker Compose · TypeScript (Node.js 24) · PostgreSQL · Redis · ports 3000 and postgres:5432
devcontainer.json (dockerComposeFile, service "app", workspaceFolder /workspaces/${localWorkspaceFolderBasename}), a Dockerfile FROM mcr.microsoft.com/devcontainers/typescript-node:5-24-trixie and docker-compose.yml with postgres:18 and redis:8.10, each with a healthcheck and a named volume; the app waits for both and gets DATABASE_URL and REDIS_URL.Container environment: GITHUB_TOKEN=ghp_abc123
"containerEnv": { "GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" }devcontainer.json is usually committed with the code, so a value whose name looks like a secret is written as a reference to the variable on your own computer.
Common uses
- Giving a team or an open-source project a one-click development environment in VS Code or GitHub Codespaces.
- Adding a database to a dev container without learning the Compose file format first.
- Turning an onboarding page of install steps into Features and a postCreateCommand that run by themselves.
- Checking which lifecycle command runs when, and what each property of devcontainer.json does.
What goes into the folder
- devcontainer.json in the .devcontainer folder: the image (or the build, or the Compose service), Features, ports, commands, environment, mounts,
customizations.vscodeand the host requirements. Only what you set is written; everything else keeps the editor’s default. - Dockerfile (with “A Dockerfile from this image” and with Docker Compose):
FROMthe official image, then your operating system packages in oneapt-getlayer (apkon Alpine) and your own lines. - docker-compose.yml (Docker Compose): the
appservice your editor works in (the project folder mounted at /workspaces,sleep infinityso it keeps running), each database with a named volume and a healthcheck, the app waiting for them withcondition: service_healthy, and a shared network, as in the official templates. The app getsDATABASE_URL,REDIS_URLorMONGODB_URI; the passwords are simple local ones, for development only.
Images, Features and versions
Images come from Microsoft’s dev container images at mcr.microsoft.com/devcontainers, written as the registry tags them: the image’s major version, then the language version and the operating system (javascript-node:5-24-trixie), so you get fixes without a sudden major change. They already include Git, a non-root user (node for Node.js and TypeScript, codespace for Universal, vscode for the others) and common tools. Features are the official Dev Container Features at ghcr.io/devcontainers/features, each pinned to its current major version; only the options you change are written, so the Feature’s defaults apply to the rest. Any other Feature can be added by its reference under More Features.
The checks
- Your values: port numbers and
service:portforms, environment variable names, mount paths (a bind mount needs a source;~is not expanded, so the page tells you to use${localEnv:HOME}), extension ids, settings JSON, user names, CPUs and memory sizes, package names and Dockerfile lines. - Combinations: two Docker Features, a Feature that duplicates what the image has, a command
waitFornames that is empty, two SQL databases giving the app oneDATABASE_URL, privileged mode without a tool that needs it. - Secrets: a variable named like a password, token or key is written as
${localEnv:NAME}, because devcontainer.json is usually committed. - The official schema: the finished devcontainer.json is validated against the devcontainer.json schema of the Development Containers Specification and the VS Code part of it, bundled with the page.
The lifecycle commands, in order
initializeCommandruns on your computer before the container is created.onCreateCommandand thenupdateContentCommandrun inside the container while it is created.postCreateCommandruns once the container is ready: installing dependencies is its usual job.postStartCommandruns every time the container starts,postAttachCommandevery time an editor attaches.
A command written on several lines runs them one after the other (joined with &&). If one lifecycle command fails, the later ones do not run (JSON reference).
Limitations
- The page does not build or start the container: open the folder in VS Code (Dev Containers), Codespaces or with the devcontainer command line to do that.
- Feature options are offered for the common cases; set any other option by adding the Feature under More Features with its options as JSON.
- Lifecycle commands are written as one shell command each; the array and parallel-object forms of the specification are not offered.
- Settings are checked as JSON, not against every setting VS Code knows.
- Browsers save a downloaded file without a leading dot in some cases; the ZIP keeps the .devcontainer folder name as it is.
Privacy
On this device: nothing is sent
Everything is generated and checked in your browser; nothing you enter is uploaded. Your last settings are remembered on this device.
Frequently asked questions
What do I get without a pass?
Without a pass, Dev Container Generator (devcontainer.json, Dockerfile and Compose) shows the generated files with the Features and lifecycle commands hidden, every check, and what each setting does. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.
Which editors read devcontainer.json?
VS Code with the Dev Containers extension, GitHub Codespaces, JetBrains IDEs through their dev container support, and the open-source devcontainer command line, among others listed on containers.dev. The customizations.vscode part applies to VS Code and Codespaces; other tools ignore it.
Where do I put the files?
In the root of your project: the ZIP holds a .devcontainer folder with devcontainer.json and, when needed, the Dockerfile and docker-compose.yml. Commit the folder, then choose “Reopen in Container” in VS Code or create a codespace from the repository.
Prebuilt image or Dockerfile?
A prebuilt image starts fastest and is enough when Features cover what you need. Choose a Dockerfile when you need operating system packages (a database client, a C library) or your own setup steps, and Docker Compose when the project needs a database or a cache next to it.
How do I keep a token out of the repository?
Put it in an environment variable on your computer and write ${localEnv:NAME} in devcontainer.json; the page does that for you when a variable’s name looks like a secret. In Codespaces, add it as a Codespaces secret.
Why are the database passwords so simple?
They are for the database inside your local dev container, which only the containers of the setup can reach, as in the official templates. Never use them for a database on a server.