-
Notifications
You must be signed in to change notification settings - Fork 863
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
d741460
add definitions to admin/index
EdwardAngert 3ed5c3e
init devcontainers best practice doc
EdwardAngert dcf901c
s/definition list/bullets
EdwardAngert 16cce07
Merge remote-tracking branch 'origin' into bp-dev-containers
EdwardAngert e96b1bc
admin/index glossary section
EdwardAngert 22e399d
when to use a dev container
EdwardAngert 4f91cd0
Merge remote-tracking branch 'origin' into bp-dev-containers
EdwardAngert 8e37e58
admin/index glossary; devcontainer known issues
EdwardAngert 985233a
devcontainer lifecycle scripts
EdwardAngert f2c59be
devcontainers directory
EdwardAngert b24f615
fix typo
EdwardAngert 4c28411
make fmt
EdwardAngert fc20dc3
suggestions from review
EdwardAngert 197cfa7
add steps in tabs to add-devcontainer
EdwardAngert 5a93ff2
fix links; list templates
EdwardAngert 8e53735
make fmt + copy review addition
EdwardAngert 80bf5da
fix link
EdwardAngert ca56186
typo fix
EdwardAngert 1491680
copy edit devcontainer/index
EdwardAngert 7f8b079
edit add-devcontainer
EdwardAngert 547cfe0
Apply suggestions from code review
EdwardAngert d22f76f
add screenshot
EdwardAngert ce0d2be
make fmt; copy tweaks
EdwardAngert 66fcca0
edit example
EdwardAngert de58159
link typo
EdwardAngert 69415d4
adjust image size
EdwardAngert ae543de
Apply suggestions from code review
EdwardAngert ca0da6d
Apply suggestions from code review
EdwardAngert 381bb73
make fmt
EdwardAngert ade54e9
close codeblock; edit starter template steps
EdwardAngert e46fc13
code review
9982af4
make fmt
182d69a
rename to dev containers
bf2e0fa
2-col table
EdwardAngert cd99937
make fmt
d17dbea
un-double bullet def list
2c3ca6d
s/devcontainer/dev container
c28f16d
comma typo
f344dff
Merge remote-tracking branch 'origin' into bp-dev-containers
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 0 additions & 112 deletions
112
docs/admin/templates/managing-templates/devcontainers.md
This file was deleted.
Oops, something went wrong.
150 changes: 150 additions & 0 deletions
150
docs/admin/templates/managing-templates/devcontainers/add-devcontainer.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): | ||
|
||
 | ||
|
||
## 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) | ||
|
||
``` | ||
|
||
``` |
25 changes: 25 additions & 0 deletions
25
...emplates/managing-templates/devcontainers/devcontainer-releases-known-issues.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May also mention to use the
git-clone
module from the registry.