🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › create-dev-container
Create a Dev Container
November 3, 2021 - You can use an image as a starting point for your devcontainer.json. An image is like a mini-disk drive with various tools and an operating system pre-installed. You can pull images from a container registry, which is a collection of repositories that store images. Here is a simple example devcontainer.json that uses a pre-built TypeScript and Node.js VS Code Development Container image:
🌐
GitHub
github.com › ardacetinkaya › devcontainer-example
GitHub - ardacetinkaya/devcontainer-example: Simple example for devcontainer.json
This is simple example for devcontainer.json for development configuration for GitHub Codespaces.
Starred by 2 users
Forked by 2 users
Languages   Shell 51.6% | Dockerfile 48.4% | Shell 51.6% | Dockerfile 48.4%
🌐
Development Containers
containers.dev › implementors › json_reference
Dev Container metadata reference
While most properties apply to any devcontainer.json supporting tool or service, a few are specific to certain tools. You may explore this in the supporting tools and services document. When creating or working with a dev container, you may need different commands to be run at different points in the container’s lifecycle. The table below lists a set of command properties you can use to update what the container’s contents in the order in which they are run (for example, onCreateCommand will run after initializeCommand).
🌐
GitHub
docs.github.com › codespaces › setting-up-your-project-for-codespaces › introduction-to-dev-containers
Introduction to dev containers - GitHub Docs
In the above example, the script that's copied to the codespace (script-in-your-repo.sh) must exist in your repository. For more information about Dockerfile instructions, see Dockerfile reference in the Docker documentation. To use a Dockerfile as part of a dev container configuration, reference it in your devcontainer.json file by using the dockerfile property.
🌐
DevPod
devpod.sh › devcontainer.json
devcontainer.json | DevPod docs | DevContainers everywhere
The primary file to configure your workspace is the devcontainer.json, that lives in the .devcontainer sub-folder of your project. This file includes information on what frameworks, tools, VS Code extensions and port-forwarding should be used during development.
🌐
Development Containers
containers.dev › templates
Templates
Development containers documentation and specification page.
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › tutorial
Dev Containers tutorial
November 3, 2021 - Finally your Visual Studio Code environment is installed and configured again according to settings in the devcontainer.json. For example, the dev container in this example installs the streetsidesoftware.code-spell-checker extension.
🌐
JetBrains
jetbrains.com › help › idea › start-dev-container-from-scratch.html
Start Dev Container from scratch | IntelliJ IDEA Documentation
February 5, 2026 - The easiest way to start is to pull an image (a predefined template) for your devcontainer.json file from a container registry (the collection of repositories with the predefined images).
Find elsewhere
🌐
Ben Selby
benmatselby.dev › post › vscode-dev-containers
Setting up a VS Code Dev Container · Ben Selby
March 21, 2021 - This is just to show an example, clearly your packages and dependencies are likely to be different. This settings file let’s you configure VS Code and the way the container runs. It’s named devcontainer.json and is also dropped into the .devcontainer folder in your project.
🌐
freeCodeCamp
freecodecamp.org › news › standardize-development-environment-with-devcontainers
How to Standardize Your Development Environment with devcontainer.json
October 4, 2023 - From: containers.dev · The file ... tailor to your specific needs. For example, you can add developer tools like git, a debugger, and other configurations like various extensions....
🌐
Marcogerber
marcogerber.ch › home › blog › dev containers: develop inside a container
Dev Containers: Develop inside a container - marcogerber.ch
April 10, 2025 - You basically define your environment in a JSON definition, from which VSCode builds a container and opens the project in it. The Dev Container Specification is now an open standard, maintained by the Dev Container Community under the Open Container Initiative (OCI), with contributions from Microsoft, GitHub, and other organizations. Instead of dealing with dependency issues or installing tools manually, you define everything in a devcontainer.json file.
🌐
GitHub
github.com › Deltares › HYDROLIB-core › blob › main › .devcontainer › devcontainer.json
HYDROLIB-core/.devcontainer/devcontainer.json at main · Deltares/HYDROLIB-core
// https://aka.ms/devcontainer.json. { "name": "Existing Dockerfile", "context": "..", "dockerFile": "../Dockerfile", "settings": {}, // Some common Python extensions which are loaded within this dev container · // Additional extensions ...
Author   Deltares
🌐
Development Containers
containers.dev › implementors › json_schema
devcontainer.json schema
} } }, "dockerfileContainer": { "oneOf": [ { "type": "object", "properties": { "build": { "type": "object", "description": "Docker build-related options.", "allOf": [ { "type": "object", "properties": { "dockerfile": { "type": "string", "description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file." }, "context": { "type": "string", "description": "The location of the context folder for building the Docker image.
Top answer
1 of 4
4

For me it worked the workspaceMount instead of mount

"workspaceMount": "source=${localWorkspaceFolder}/sub-folder,target=/workspace,type=bind,consistency=delegated",
"workspaceFolder": "/workspace"

as stated in https://code.visualstudio.com/docs/remote/containers-advanced

2 of 4
4

Docker-in-Docker

Using docker-compose

When working with a Docker-in-Docker setup which utilizes the docker-compose functionality, the VSCode internal variable ${localWorkspaceFolder} can be used to get the actual path to the workspace on disk. This is needed because in a Docker-in-Docker environment, "normal" paths may not work as the first Docker instance is already running in a mounted environment.

In order to make those internal VSCode variables also accessible in the docker-compose.yaml, you first need to define an environment variable in your .devcontainer/devcontainer.json:

{
  "name": "DevContainer",
  "dockerFile": "Dockerfile", // this is a reference to the .devcontainer/Dockerfile, which is used by VSCode to build the DevContainer. This has nothing to do with the Dockerfile or docker-compose.yaml file your project is using.

  "remoteEnv": {
    // the original host directory which is needed for volume 
    // mount commands from inside the container (Docker in Docker)
    "HOST_PROJECT_PATH": "${localWorkspaceFolder}"
  }
}

Then, use the environment variable in your project's actual ./docker-compose.yaml:

services:
  webserver:
    image: nginx:mainline-alpine
    container_name: webserver
    ports:
      - 8080:80
    volumes:
       -  ${HOST_PROJECT_PATH}/webserver:/etc/nginx/conf.d
       -  ${HOST_PROJECT_PATH}/build:/var/www/html

VSCode provides even more internal variables which can be used for advanced setup and configuration of the DevContainer environment. Please have a look here.

Using Dockerfile

More information on how to use Docker-in-Docker with Dockerfiles can be found here.

🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › containers
Developing inside a Container
November 3, 2021 - You can also create a devcontainer.json by hand and use any image, Dockerfile, or set of Docker Compose files as a starting point. Here is a simple example that uses one of the pre-built Development Container images:
🌐
Development Containers
containers.dev › supporting
Supporting tools and services
GitHub Codespaces works with a growing number of tools and, where applicable, their devcontainer.json properties. For example, connecting the Codespaces web editor or VS Code enables the use of VS Code properties.
🌐
Cursor
forum.cursor.com › bug reports
Devcontainer.json vs repo.code-workspace files - Bug Reports - Cursor - Community Forum
July 16, 2025 - Describe the Bug what is the difference between using these two files? When we use devcontianer.json, AFAIK, we create a dev container with the specified things in devcontainer.json. Should we open the workspace folder i…
🌐
Medium
medium.com › cwan-engineering › reproducible-local-development-with-dev-containers-0ed5fa850b36
Reproducible Local Development with Dev Containers | by Clearwater Analytics Engineering | cwan-engineering | Medium
October 19, 2023 - All of the files described in this section should be placed in a folder called .devcontainer at the root of your repository. For any details or files that are mentioned but not spelled out here, check out the example files in https://github.com/clearwater-analytics/devcontainer-java-example/tree/main/.devcontainer. It all starts with the devcontainer.json file.
🌐
Steve Kinney
stevekinney.com › courses › visual studio code › configuring your dev container
Configuring Your Dev Container | Visual Studio Code | Steve Kinney
March 16, 2026 - Example: "image": "mcr.microsoft.com/devcontainers/javascript-node:18" (Uses a pre-built Node.js 18 image from Microsoft’s Dev Containers registry).
🌐
Docker
docker.com › blog › streamlining-local-development-with-dev-containers-and-testcontainers-cloud
Streamlining Local Development with Dev Containers and Testcontainers Cloud | Docker
September 18, 2024 - This description of an isolated environment can be easily transferred and launched on any computer or cloud infrastructure, allowing developers and teams to abstract away the specifics of their operating systems. The dev container settings are defined in a devcontainer.json file, which is located within a given project, ensuring consistency across different environments.