|
| 1 | +# Development Container |
| 2 | + |
| 3 | +Instead of manually configuring your development environment, [Dev Containers](https://containers.dev/) offer a seamless containerized development experience right out of the box. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you can use a Dev Container, you will need to install a few components. |
| 8 | + |
| 9 | +1. [Docker Desktop](https://www.docker.com/products/docker-desktop) or an [alternative Docker option](https://code.visualstudio.com/remote/advancedcontainers/docker-options). |
| 10 | +1. [Visual Studio Code](https://code.visualstudio.com/). |
| 11 | +1. The [Dev Containers extension](vscode:extension/ms-vscode-remote.remote-containers) within VSCode. |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +After installing the prerequisites, you have two main approaches to use a Dev Container. Using [a locally cloned repository](#open-a-locally-cloned-repository-in-a-container) leverages your existing local source code, while [an isolated container volume](#open-the-repository-in-an-isolated-container-volume) creates a separate copy of the repository, which is particularly useful for PR reviews or exploring branches without altering your local environment. |
| 16 | + |
| 17 | +### Open a locally cloned repository in a container |
| 18 | + |
| 19 | +When you open a repository that includes a Dev Container configuration in VS Code, you will receive a prompt to reopen it in the container. |
| 20 | + |
| 21 | +```{image} /_static/images/dev-container-reopen-prompt.png |
| 22 | +:alt: Dev Container Reopen Prompt. |
| 23 | +``` |
| 24 | + |
| 25 | +If you missed the prompt, you can use the **Dev Containers: Reopen in Container** command from the Command Palette to initiate the containerized environment. Here are some frequently used commands: |
| 26 | + |
| 27 | +Dev Containers: Reopen in Container |
| 28 | +: Triggers the containerized environment setup upon opening a repository configured for Dev Containers. |
| 29 | + |
| 30 | +Dev Containers: Rebuild Without Cache and Reopen in Container |
| 31 | +: Useful for refreshing your environment in case of issues or to update to a newer version. |
| 32 | + |
| 33 | +Dev Containers: Clean Up Dev Containers... |
| 34 | +: Deletes stopped Dev Container instances and removes unused volumes, helping maintain a clean development environment. |
| 35 | + |
| 36 | +### Open the repository in an isolated container volume |
| 37 | + |
| 38 | +You may already notice the badge [](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/{{ repo_namespace }}/{{ repo_name }}) in the [Overview](/index.md) page. you can click the badge or [this link](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/{{ repo_namespace }}/{{ repo_name }}) to set up everything needed for the Dev Container experience, including cloning the source code into a container volume. |
| 39 | + |
| 40 | +## Reference |
| 41 | + |
| 42 | +For more detailed guidance and advanced usage, explore the following resources: |
| 43 | + |
| 44 | +- [Dev Containers tutorial](https://code.visualstudio.com/docs/devcontainers/tutorial) |
| 45 | +- [Developing inside a Container](https://code.visualstudio.com/docs/devcontainers/containers) |
0 commit comments