- Notifications
You must be signed in to change notification settings - Fork1.1k
docs: improve dev containers documentation for user start-up#15458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
d7414603ed5c3edcf901c16cce07e96b1bc22e399d4f91cd08e37e58985233af2c59beb24f6154c28411fc20dc3197cfa75a93ff28e5373580bf5daca5618614916807f8b079547cfe0d22f76fce0d2be66fcca0de5815969415d4ae543deca0da6d381bb73ade54e9e46fc139982af4182d69abf2e0facd99937d17dbea2c3ca6dc28f16df344dffFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| # Add a dev container template to Coder | ||
| A Coder administrator adds a dev container-compatible template to Coder | ||
| (Envbuilder). This allows the template to prompt for the developer for their dev | ||
| container repository's URL as a | ||
| [parameter](../../extending-templates/parameters.md) when they create their | ||
| workspace. Envbuilder clones the repo and builds a container from the | ||
| `devcontainer.json` specified in the repo. | ||
| You can create template files through the Coder dashboard, CLI, or you can | ||
| choose a template from the | ||
| [Coder registry](https://registry.coder.com/templates): | ||
| <div class="tabs"> | ||
| ## Dashboard | ||
| 1. In the Coder dashboard, select **Templates** then **Create Template**. | ||
| 1. Use a | ||
| [starter template](https://github.com/coder/coder/tree/main/examples/templates) | ||
| or create a new template: | ||
| - Starter template: | ||
| 1. Select **Choose a starter template**. | ||
| 1. Choose a template from the list or select **Devcontainer** from the | ||
| sidebar to display only dev container-compatible templates. | ||
| 1. Select **Use template**, enter the details, then select **Create | ||
| template**. | ||
| - To create a new template, select **From scratch** and enter the templates | ||
| details, then select **Create template**. | ||
| 1. Edit the template files to fit your deployment. | ||
| ## CLI | ||
| 1. Use the `template init` command to initialize your choice of image: | ||
| ```shell | ||
| coder template init --id devcontainer-kubernetes | ||
| ``` | ||
| A list of available templates is shown in the | ||
| [templates_init](../../../../reference/cli/templates.md) reference. | ||
| 1. `cd` into the directory and push the template to your Coder deployment: | ||
| ```shell | ||
| cd devcontainer-kubernetes && coder templates push | ||
| ``` | ||
| You can also edit the files or make changes to the files before you push them | ||
| to Coder. | ||
| ## Registry | ||
| 1. Go to the [Coder registry](https://registry.coder.com/templates) and select a | ||
| dev container-compatible template. | ||
| 1. Copy the files to your local device, then edit them to fit your needs. | ||
| 1. Upload them to Coder through the CLI or dashboard: | ||
| - CLI: | ||
| ```shell | ||
| coder templates push <template-name> -d <path to folder containing main.tf> | ||
| ``` | ||
| - Dashboard: | ||
| 1. Create a `.zip` of the template files: | ||
| - On Mac or Windows, highlight the files and then right click. A | ||
| "compress" option is available through the right-click context menu. | ||
| - To zip the files through the command line: | ||
| ```shell | ||
| zip templates.zip Dockerfile main.tf | ||
| ``` | ||
| 1. Select **Templates**. | ||
| 1. Select **Create Template**, then **Upload template**: | ||
|  | ||
| 1. Drag the `.zip` file into the **Upload template** section and fill out the | ||
| details, then select **Create template**. | ||
|  | ||
| </div> | ||
| To set variables such as the namespace, go to the template in your Coder | ||
| dashboard and select **Settings** from the **⋮** (vertical ellipsis) menu: | ||
| <Image height="255px" src="../../../../images/templates/template-menu-settings.png" alt="Choose Settings from the template's menu" align="center" /> | ||
| ## Envbuilder Terraform provider | ||
| When using the | ||
| [Envbuilder Terraform provider](https://registry.terraform.io/providers/coder/envbuilder/latest/docs), | ||
| a previously built and cached image can be reused directly, allowing dev | ||
| containers to start instantaneously. | ||
| Developers can edit the `devcontainer.json` in their workspace to customize | ||
| their development environments: | ||
| ```json | ||
| # … | ||
| { | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/common-utils:2": {} | ||
| } | ||
| } | ||
| # … | ||
| ``` | ||
| ## Example templates | ||
| | Template | Description | | ||
| | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | [Docker dev containers](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-docker) | Docker provisions a development container. | | ||
| | [Kubernetes dev containers](https://github.com/coder/coder/tree/main/examples/templates/devcontainer-kubernetes) | Provisions a development container on the Kubernetes cluster. | | ||
| | [Google Compute Engine dev container](https://github.com/coder/coder/tree/main/examples/templates/gcp-devcontainer) | Runs a development container inside a single GCP instance. It also mounts the Docker socket from the VM inside the container to enable Docker inside the workspace. | | ||
| | [AWS EC2 dev container](https://github.com/coder/coder/tree/main/examples/templates/aws-devcontainer) | Runs a development container inside a single EC2 instance. It also mounts the Docker socket from the VM inside the container to enable Docker inside the workspace. | | ||
| Your template can prompt the user for a repo URL with | ||
| [parameters](../../extending-templates/parameters.md): | ||
Comment on lines +130 to +131 Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. May also mention to use the | ||
|  | ||
| ## Dev container lifecycle scripts | ||
| The `onCreateCommand`, `updateContentCommand`, `postCreateCommand`, and | ||
| `postStartCommand` lifecycle scripts are run each time the container is started. | ||
| This could be used, for example, to fetch or update project dependencies before | ||
| a user begins using the workspace. | ||
| Lifecycle scripts are managed by project developers. | ||
| ## Next steps | ||
| - [Dev container security and caching](./devcontainer-security-caching.md) | ||
| ``` | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Dev container releases and known issues | ||
| ## Release channels | ||
| Envbuilder provides two release channels: | ||
| - **Stable** | ||
| - Available at | ||
| [`ghcr.io/coder/envbuilder`](https://github.com/coder/envbuilder/pkgs/container/envbuilder). | ||
| Tags `>=1.0.0` are considered stable. | ||
| - **Preview** | ||
| - Available at | ||
| [`ghcr.io/coder/envbuilder-preview`](https://github.com/coder/envbuilder/pkgs/container/envbuilder-preview). | ||
| Built from the tip of `main`, and should be considered experimental and | ||
| prone to breaking changes. | ||
Comment on lines +7 to +15 Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I have this above, but let's avoid this double-bullet-point formatting | ||
| Refer to the | ||
| [Envbuilder GitHub repository](https://github.com/coder/envbuilder/) for more | ||
| information and to submit feature requests or bug reports. | ||
| ## Known issues | ||
| Visit the | ||
| [Envbuilder repository](https://github.com/coder/envbuilder/blob/main/docs/devcontainer-spec-support.md) | ||
| for a full list of supported features and known issues. | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.