- Notifications
You must be signed in to change notification settings - Fork914
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
d741460
3ed5c3e
dcf901c
16cce07
e96b1bc
22e399d
4f91cd0
8e37e58
985233a
f2c59be
b24f615
4c28411
fc20dc3
197cfa7
5a93ff2
8e53735
80bf5da
ca56186
1491680
7f8b079
547cfe0
d22f76f
ce0d2be
66fcca0
de58159
69415d4
ae543de
ca0da6d
381bb73
ade54e9
e46fc13
9982af4
182d69a
bf2e0fa
cd99937
d17dbea
2c3ca6d
c28f16d
f344dff
File 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 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 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.