Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

.vscode/devContainer.json => .devcontainer/devcontainer.json #9

Merged
merged 10 commits into from
Apr 5, 2019
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dev Container Editing",
"dockerFile": ".vscode/Dockerfile",
"dockerFile": ".devcontainer/Dockerfile",
"extensions": [
"yzhang.markdown-all-in-one",
"streetsidesoftware.code-spell-checker",
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,16 @@ If you want to create a new definition:

```
📁 <language>-<optional: version>-<descriptor>
📁 .vscode
📄 devContainer.json
📁 .devcontainer
📄 devcontainer.json
📄 Dockerfile (optional)
📄 docker-compose.yml (optional)
📄 ignore
📁 test-project (optional)
📄 README.md
```

See the [VS Code Remote Development documentation](https://aka.ms/vscode-remote/docker) for information on the expected contents of `devContainer.json` and how it relates to other files listed above.
See the [VS Code Remote Development documentation](https://aka.ms/vscode-remote/docker) for information on the expected contents of `devcontainer.json` and how it relates to other files listed above.

Note that any additional assets can be included as needed, but keep in mind that these will overlay on top of an existing project. Keeping these files in the `.devcontainer` should reduce the chances of something conflicting but note that any command that are run are relative to the root of the project, so you'll need to include `.devcontainer` in any path references.

Expand All @@ -136,7 +135,7 @@ Finally, after you get your container up and running, you can test it by adding

While using a `Dockerfile` is a convienent way to get going with a new container definition, this method can slow down the process of creating the dev container since it requires the image be built by anyone using it. If your definition is stable, we strongly reccomend building and publishing your image to [DockerHub](https://hub.docker.com) or [Azure Container Registry](https://azure.microsoft.com/en-us/services/container-registry/) instead.

Once you've published your container image, just update `devContainer.json` to reference the image instead of the `Dockerfile`. See `container-templates/image` for an example.
Once you've published your container image, just update `devcontainer.json` to reference the image instead of the `Dockerfile`. See `container-templates/image` for an example.

## Contributing to Documentation

Expand Down
56 changes: 24 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,60 @@ The Containers extension in the [Visual Studio Code Remote Development](https://

**[Learn more about the Visual Studio Code Remote - Containers extension](https://aka.ms/vscode-remote/containers)**.

This repository contains a set of **dev container definitions** made up of files like `devContainer.json` to help get you up and running in a containerized environment. These definitions describe the needed container image, any runtime arguments for starting the container, and any VS Code extensions that should be installed into it.
This repository contains a set of **dev container definitions** made up of files like `devcontainer.json` to help get you up and running in a containerized environment. These definitions describe the needed container image, any runtime arguments for starting the container, and any VS Code extensions that should be installed into it. They're can be useful to help you get started or as samples for how to adapt your own configuration to different situations.

## Trying a definition

1. Click on one of the `containers` sub-folders to open it in your browser
2. Check out the README to see if there are any manual steps
3. Clone this repository or copy the contents of the folder to your machine
4. Run the **Remote: Open Folder in Container...** command in VS Code
5. Select the definition folder in the "open" dialog
5. Select the root of the definition folder in the "open" dialog (**not** the `test-project` folder if present)

Many definitions include a `test-project` that you can use to see the dev container in action. Note that if you open this folder locally instead, you'll be prompted to reopen it in a container as well. You can also use the **Remote: Reopen Folder in Container** command at any time.
Many definitions include a `test-project` with a sample and/or launch settings in the `.vscode` folder that you can use to see the dev container in action. If you open the folder locally instead, you'll be prompted to reopen it in a container but uou can also use the **Remote: Reopen Folder in Container** command at any time.

## Using a definition

You can either:

- Manually copy the contents of one of the `containers` sub-folders into your project. Copy the `.devcontainer` folder into your project and you should be ready to go!

- Run **Remote: Create Container Configuration File...** command in VS Code and pick a definition. The appropriate files will then be added to your project.

- Manually copy the contents of one of the `containers` sub-folders into your project. Copy the `.devcontainer` folder and `.vscode/devContainer.json` into your project and you should be ready to go!
## Adding a definition to an existing public or private repo

You can easily share a customized dev container definition for your project by simply adding files like `.devcontainer/devcontainer.json` to source control. By including these files in your repository, anyone that opens a local copy of your repo in VS Code will be automatically asked if they want reopen the folder in a container instead if the [Remote Development](https://aka.ms/vscode-remote/download/extension) extension installed.

### Can I just reuse an existing Docker configuration?
Beyond the advantages of having your team use a consistent environment and tool-chain, doing this can make it easier for new contributors or team members to get productive quickly. First-time contributors will require less guidance and are less likely to either submit issues or contribute code with issues that are related to environment setup.

Absolutely! If you want to use an existing Dockerfile as a starting point, run **Remote-Containers: Create Container Configuration File...** from the command pallette (Cmd/Ctrl+Shift+P). You'll be prompted to select a Dockerfile or you can opt to use a base image instead.
## Contents

#### About `.vscode/devContainer.json`
- `containers` - Dev container definition folders.
- `container-templates` - Templates for creating your own container definitions in your project or for contributing back to this repository.

The intent of `devContainer.json` is conceptually similar to VS Code's `launch.json` for debugging, but designed to launch (or attach to) your development container instead. At its simplest, all you need to do is add a `.vscode/devContainer.json` file to your project and reference an image, `Dockerfile`, or `docker-compose.yml`.
## Common Questions

Since you are here, check out the [existing Dockerfile](containers/docker-existing-dockerfile) and [existing Docker Compose](containers/docker-existing-docker-compose) definitions for details, but here's the a quick tour of the basic properties. If you have a `Dockerfile`, set these properties:
#### Can I just reuse an existing container image or Docker configuration?

```json
{
"name": "[Optional] Your project name here",
"dockerFile": "Dockerfile"
}
```
Absolutely! If you want to use an existing Dockerfile as a starting point, run **Remote-Containers: Create Container Configuration File...** from the command pallette (Cmd/Ctrl+Shift+P). You'll be prompted to select a Dockerfile or you can opt to use a base image instead and customize from there.

For Docker Compose, you can [attach to an already running container](https://aka.ms/vscode-remote/containers/attach) or configure `.vscode/devContainer.json` with these properties:
You can also check out the [existing Dockerfile](containers/docker-existing-dockerfile) and [existing Docker Compose](containers/docker-existing-docker-compose) definitions for an example. You can also [attach to an already running container](https://aka.ms/vscode-remote/containers/attach) if you'd prefer.

```json
{
"name": "[Optional] Your project name here",
"dockerComposeFile": "docker-compose.yml",
"service": "the-name-of-the-service-you-want-to-work-with-in-vscode",
"volume": "name-of-volume-where-source-code-is-located"
}
```
##### What is the goal of `devcontainer.json`?

Note that, if you only have a single deployment / non-development focused `docker-compose.yml`, you may want to [extend your Docker Compose file](https://aka.ms/vscode-remote/docker/docker-compose/development-version) to override or supplement what happens when your containers are started.
The intent of `devcontainer.json` is conceptually similar to VS Code's `launch.json` for debugging, but designed to launch (or attach to) your development container instead. At its simplest, all you need to do is add a `.devcontainer/devcontainer.json` file to your project and reference an image, `Dockerfile`, or `docker-compose.yml` and a few properties.

The other definitions in the `containers` folder will provide examples of how to cover new scenarios you may encounter along the way. For example, you may want to [alter your configuration](https://aka.ms/vscode-remote/containers/folder-setup) to install additional tools like Git in the container, automatically install extensions, expose additional ports, or set runtime arguments. In other cases, you may just want to [attach to an already running container](https://aka.ms/vscode-remote/containers/attach).
Check out the `container-templates` folder for simple examples. The definitions in the `containers` folder can be used as-is or as samples for how to modify your existing config to support different scenarios. From there, you can [alter your configuration](https://aka.ms/vscode-remote/containers/folder-setup) to install additional tools like Git in the container, automatically install other extensions, expose additional ports, set runtime arguments, and more.

## Adding a definition to an existing public or private repo
### Are development containers intended to define how an application is deployed?

You can easily share a customized dev container definition for your project by simply adding files like `.vscode/devContainer.json` to source control. By including these files in your repository, anyone that opens a local copy of your repo in VS Code will be automatically asked if they want reopen the folder in a container instead if the [Remote Development](https://aka.ms/vscode-remote/download/extension) extension installed.
No. A development container is an environment that you can use to develop your application even before you are ready to build or deploy. While deployment and development containers may resemble one another, you often will not include tools in a deployment image that you will want during development. The set of "dev container definitions" found in the [vscode-dev-containers repo](https://aka.ms/vscode-dev-containers) are intended to help jump start the process of creating a development container by including a set of well-known container build or deployment files and a `devcontainer.json` file. This file provides a home for tooling and edit-time related settings and a pointer to the image (or files that define the image) that should be used for the development container. However, their use is entirely optional, and you can [attach to a running container](https://aka.ms/vscode-remote/attach) in other container-based workflows and scenarios.

Beyond the advantages of having your team use a consistent environment and tool-chain, doing this can make it easier for new contributors or team members to get productive quickly. First-time contributors will require less guidance and are less likely to either submit issues or contribute code with issues that are related to environment setup.
### Are development containers intended to define how an application is built? Like Buildpacks?

## Contents
No. The [Buildpack](https://buildpacks.io/) concept focuses on taking source code and generating deployable container images through a series of defined steps. A dev container is an environment you can use to develop your application even before you are ready to build. They are therefore complementary concepts. The `devcontainer.json` file is not intended to define how your application should be built, but rather provides a home for tooling and edit-time related settings and a pointer to an image or image definition files. Today it supports pointing to an existing image (which could be generated by a Buildpack), a Dockerfile, or one or more `docker-compose.yml` files, but more will be added as the community has interest. You can also opt to [attach to a running container](https://aka.ms/vscode-remote/attach) if you prefer to use an alternate container build or deployment workflow.

- `containers` - Dev container definition folders.
- `container-templates` - Templates for creating your own container definitions in your project or for contributing back to this repository.
Similarly, the "dev container definitions" found in the [vscode-dev-containers repo](https://aka.ms/vscode-dev-containers) can help jump start the process of creating a dev container when you do not have an existing image, `Dockerfile`, or `docker-compose.yml`. These can also act as samples if you do have existing container files. However, they are not intended to define how an application should be built.

## Contributing & Feedback

Expand Down
2 changes: 0 additions & 2 deletions containers/azure-cli/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/azure-functions-node-8/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/azure-hdinsight-python-3/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json

This file was deleted.

2 changes: 0 additions & 2 deletions containers/azure-terraform/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/cpp/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/dart-web/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Existing Docker Compose",

// Update the dockerComposeFile list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.

"dockerComposeFile": [
"docker-compose.yml",
".devcontainer/docker-compose.yml"
],

// The "service" property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.

"service": "your-service-name-here",

// The optonal "workspaceFolder" property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml

"workspaceFolder": "/workspace"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Existing Dockerfile",

// Update the "dockerFile" property if you aren't using the standard 'Dockerfile' filename.

"dockerFile": "Dockerfile",

// Use the optional "appPort" property to expose ports not already in your Dockerfile

"appPort": [],

// The optional "runArgs" property can be used to specify Docker CLI arguments to use when the container.
// is started. If you install the Docker CE CLI in your container, the runArgs list below will lets you interact
// with your host's Docker service from inside the container. See the docker-in-docker and docker-in-docker-compose
// definitions for details.

"runArgs": ["-v","/var/run/docker.sock:/var/run/docker.sock"]
}
2 changes: 0 additions & 2 deletions containers/docker-existing-dockerfile/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
14 changes: 0 additions & 14 deletions containers/docker-existing-dockerfile/.vscode/devContainer.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Docker-in-Docker",
"dockerComposeFile": ".devcontainer/docker-compose.yml",
"service": "docker-in-docker",
"volume": "workspace",
"workspaceFolder": "/workspace",
"extensions": [
"peterjausovec.vscode-docker"
]
Expand Down
2 changes: 0 additions & 2 deletions containers/docker-in-docker-compose/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/docker-in-docker/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/dotnetcore-2.2-fsharp/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/dotnetcore-2.2/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/go/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/java-8-maven/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Node.js & Mongo DB",
"dockerComposeFile": ".devcontainer/docker-compose.yml",
"service": "web",
"volume": "app",
"workspaceFolder": "/workspace",
"extensions": [
"dbaeumer.vscode-eslint"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- ..:/app
- ..:/workspace
ports:
- "3000:3000"
command: sleep infinity
Expand Down
2 changes: 0 additions & 2 deletions containers/javascript-node-8-mongo/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/javascript-node-8/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/kubernetes-helm/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/markdown/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/php-7/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/plantuml/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/powershell/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/python-2/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
2 changes: 0 additions & 2 deletions containers/python-3-django/.devcontainer/ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
README.md
test-project
.vscode
!.vscode/devContainer.json
!.vscode/devcontainer.json
Loading