You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/remote/containers.md
+36-17Lines changed: 36 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,7 @@ This quick start covers how to set up a dev container for an existing project to
105
105
106
106
The list will be automatically sorted based on the contents of the folder you open.
107
107
108
-
You may be able to customize your dev container with additional features, which [you can read more about below](#dev-container-features-preview).
108
+
You may be able to customize your dev container with additional Features, which [you can read more about below](#dev-container-features-preview).
109
109
110
110
The dev container definitions displayed come from the [vscode-dev-containers repository](https://aka.ms/vscode-dev-containers). You can browse the `containers` folder of that repository to see the contents of each definition.
111
111
@@ -260,45 +260,58 @@ Selecting the **Remote-Containers: Add Development Container Configuration Files
260
260
261
261
To learn more about creating `devcontainer.json` files, see [Create a Development Container](/docs/remote/create-dev-container.md).
262
262
263
-
## Dev container features (preview)
263
+
## Dev Container Features (preview)
264
264
265
-
Dev container features provide a smooth path for customizing your container definitions.
265
+
Development container "Features" are self-contained, shareable units of installation code and dev container configuration. The name comes from the idea that referencing one of them allows you to quickly and easily add more tooling, runtime, or library "Features" into your development container for you or your collaborators to use.
266
266
267
267
When you use **Remote-Containers: Add Development Container Configuration Files**, you're presented a list of scripts to customize the existing dev container configurations, such as installing Git or the Azure CLI:
268
268
269
-

269
+

270
270
271
-
When you rebuild and reopen in your container, the features you selected will be available in your `devcontainer.json`:
271
+
When you rebuild and reopen in your container, the Features you selected will be available in your `devcontainer.json`:
272
272
273
273
```json
274
274
"features": {
275
-
"github-cli": "latest"
275
+
"ghcr.io/devcontainers/features/github-cli:1": {
276
+
"version": "latest"
277
+
}
276
278
}
277
279
```
278
280
279
281
You'll get IntelliSense when editing the `"features"` property in the `devcontainer.json` directly:
280
282
281
-

283
+

282
284
283
-
Built-in features are sourced from the [script library](https://github.com/microsoft/vscode-dev-containers/tree/main/script-library/docs) folder in the vscode-dev-containers repo, but the Remote - Containers extension and GitHub Codespaces include an **early preview** for creating your own dev container features. For example, you can reference these as follows:
285
+
The **Remote-Containers: Configure Container Features** command allows you to update an existing configuration.
The Features sourced in VS Code UI come from the [`devcontainers/features` repository](https://github.com/devcontainers/features).
288
+
289
+
### Creating your own feature
290
+
291
+
It's also easy to create and publish your own Dev Container Features. Published Features can be stored and shared as [OCI Artifacts](https://github.com/opencontainers/artifacts) from any supporting public or private container registry. You can see the list of current published Features on [containers.dev](https://containers.dev/features.html).
292
+
293
+
A Feature is a self contained entity in a folder with at least a `devcontainer-feature.json` and `install.sh` entrypoint script:
294
+
295
+
```
296
+
+-- feature
297
+
| +-- devcontainer-feature.json
298
+
| +-- install.sh
299
+
| +-- (other files)
289
300
```
290
301
291
-
The form and format of these custom features is still in flux, but you can try creating your own dev container feature using the [dev-container-features-template](https://github.com/microsoft/dev-container-features-template)sample repository. Let us know what you think!
302
+
See the [latest template](https://github.com/devcontainers/feature-template)for instructions on using the dev container CLI to publish your own public or private Features!
292
303
293
-
The **Remote-Containers: Configure Container Features** command allows you to update an existing configuration.
304
+
### Features proposal and distribution
305
+
306
+
Features are an active proposal in the open dev container specification. You can review the [Features proposal](https://github.com/devcontainers/spec/issues/61), along with [greater information about how Features work](https://containers.dev/implementors/features/) and their [distribution](https://containers.dev/implementors/features-distribution/).
294
307
295
308
## Pre-building dev container images
296
309
297
310
We recommend pre-building images with the tools you need rather than creating and building a container image each time you open your project in a dev container. Using pre-built images will result in a faster container startup, simpler configuration, and allows you to pin to a specific version of tools to improve supply-chain security and avoid potential breaks. You can automate pre-building your image by scheduling the build using a DevOps or continuous integration (CI) service like GitHub Actions.
298
311
299
-
We recommend using the [devcontainer CLI](/docs/remote/devcontainer-cli.md) to pre-build your images since it is kept in sync with the Remote - Container extension's latest capabilities - including [dev container features](#dev-container-features-preview). Once you've built your image, you can push it to a container registry (like the [Azure Container Registry](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli), [GitHub Container Registry](https://docs.github.com/packages/working-with-a-github-packages-registry/working-with-the-container-registry#pushing-container-images), or [Docker Hub](https://docs.docker.com/engine/reference/commandline/push)) and reference it directly.
312
+
We recommend using the [devcontainer CLI](/docs/remote/devcontainer-cli.md) to pre-build your images since it is kept in sync with the Remote - Container extension's latest capabilities - including [dev container Features](#dev-container-features-preview). Once you've built your image, you can push it to a container registry (like the [Azure Container Registry](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli), [GitHub Container Registry](https://docs.github.com/packages/working-with-a-github-packages-registry/working-with-the-container-registry#pushing-container-images), or [Docker Hub](https://docs.docker.com/engine/reference/commandline/push)) and reference it directly.
300
313
301
-
See the [devcontainer CLI article on pre-building images](/docs/remote/devcontainer-cli.md#building-a-dev-container-image) for more information.
314
+
See the [devcontainer CLI article on pre-building images](/docs/remote/devcontainer-cli.md#pre-building) for more information.
302
315
303
316
## Inspecting volumes
304
317
@@ -695,6 +708,12 @@ The following articles may help answer your question:
695
708
*[Docker Desktop for Mac troubleshooting guide](https://docs.docker.com/docker-for-mac/troubleshoot) and [FAQ](https://docs.docker.com/docker-for-mac/faqs/)
696
709
*[Docker Support Resources](https://success.docker.com/article/best-support-resources)
697
710
711
+
### Can I use dev containers outside of VS Code?
712
+
713
+
As containerizing production workloads becomes commonplace, dev containers have become broadly useful for scenarios beyond VS Code. We're creating the **Development Containers Specification** to empower anyone in any tool to configure a consistent dev environment. It seeks to find ways to enrich existing formats with common development specific settings, tools, and configuration while still providing a simplified, un-orchestrated single container option – so that they can be used as coding environments or for continuous integration and testing.
714
+
715
+
You can learn more and review the spec on [containers.dev](https://containers.dev), and you can review active proposals and contribute to the spec in the [devcontainers/spec](https://github.com/devcontainers/spec) repository on GitHub.
716
+
698
717
## Questions or feedback
699
718
700
719
* See [Tips and Tricks](/docs/remote/troubleshooting.md#container-tips) or the [FAQ](/docs/remote/faq.md).
@@ -710,4 +729,4 @@ The following articles may help answer your question:
710
729
*[Attach to a Running Container](/docs/remote/attach-container.md) - Attach to an already running Docker container.
711
730
*[Create a Development Container](/docs/remote/create-dev-container.md) - Create a custom container for your work environment.
712
731
*[Advanced Containers](/remote/advancedcontainers/overview.md) - Find solutions to advanced container scenarios.
713
-
*[devcontainer.json reference](/docs/remote/devcontainerjson-reference.md) - Review the `devcontainer.json` schema.
732
+
*[devcontainer.json reference](https://containers.dev/implementors/json_reference/) - Review the `devcontainer.json` schema.
Copy file name to clipboardExpand all lines: docs/remote/devcontainer-cli.md
+64-1Lines changed: 64 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -126,13 +126,76 @@ These steps above are also provided in the CLI repo's [README](https://github.co
126
126
127
127
If you'd like to use the dev container CLI in your CI/CD builds or test automation, you can find examples of GitHub Actions and Azure DevOps Tasks in the [devcontainers/ci](https://github.com/devcontainers/ci) repository.
128
128
129
+
## Pre-building
130
+
131
+
The `devcontainer build` command allows you to build quickly build dev container image following the same steps the Remote - Containers extension or GitHub Codespaces will. This is particularly useful when you want to pre-build a dev container image using a CI or DevOps product like GitHub Actions.
132
+
133
+
`build` accepts a path to the folder containing a `.devcontainer` folder or `.devcontainer.json` file. For example, `devcontainer build --workspace-folder <my_repo>` will build the container image for `my_repo`.
134
+
135
+
### Example of building and publishing an image
136
+
137
+
For example, you may want to pre-build a number of images that you then reuse across multiple projects or repositories. To do so, follow these steps:
138
+
139
+
1.[Create](/docs/editor/versioncontrol.md#initialize-a-repository) a source code repository.
140
+
141
+
1. Create dev container configuration for each image you want to pre-build, customizing as you wish (including [dev container Features](#dev-container-features-preview)). For example, consider this devcontainer.json file:
1. Use the `devcontainer build` command to build the image and [push](https://docs.docker.com/engine/reference/commandline/push/) it to your image registry. See documentation for your image registry (like the [Azure Container Registry](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-docker-cli?tabs=azure-cli), [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#pushing-container-images), or [Docker Hub](https://docs.docker.com/engine/reference/commandline/push)) for information on image naming and additional steps like authentication.
1. Create a simplified devcontainer.json in repositories where you'd like to use the image - the devcontainer.json should either use the `image` property or reference the image in an associated Docker Compose file. Include any dev container Features you added in your pre-build configuration. For example:
On the other hand, if you only intend to use the pre-built image from one repository, you can use the `cacheFrom` property in devcontainer.json or `cache_from` in a related Docker Compose file instead. This will download the image and treat its image layers like a local cache even if this is the first time you've created the Dockerfile on your machine. Like the option above, be sure to include any dev container Features. For example:
## Avoiding problems with images built using Docker
189
+
190
+
Given Dockerfiles and Docker Compose files can be used without VS Code or the `devcontainer` CLI, you may want to let users know that they should not try to build the image directly. You may learn more in the [advanced dev container documentation](../../remote/advancedcontainers/reduce-docker-warnings.md#avoiding-problems-with-images-built-using-docker).
191
+
129
192
## Feedback
130
193
131
194
The dev container CLI and specification are under active development and we welcome your feedback, which you can provide in [this issue](https://github.com/devcontainers/cli/issues/7), or through new issues and pull requests in the [devcontainers/cli](https://github.com/devcontainers/cli) repository.
132
195
133
196
## Next steps
134
197
135
198
* [Dev container specification repository](https://github.com/devcontainers/spec) - Read and contribute to the open specification.
136
-
*[devcontainer.json reference](/docs/remote/devcontainerjson-reference.md) - Review the `devcontainer.json` schema.
199
+
* [devcontainer.json reference](https://containers.dev/implementors/json_reference/) - Review the `devcontainer.json` schema.
137
200
* [Create a Development Container](/docs/remote/create-dev-container.md) - Create a custom container for your work environment.
138
201
* [Advanced Containers](/remote/advancedcontainers/overview.md) - Find solutions to advanced container scenarios.
0 commit comments