1
- # Dev Containers (alpha)
1
+ # Dev Containers
2
2
3
3
[ Development containers] ( https://containers.dev ) are an open source
4
4
specification for defining development environments.
5
5
6
- [ envbuilder ] ( https://github.com/coder/envbuilder ) is an open source project by
6
+ [ Envbuilder ] ( https://github.com/coder/envbuilder ) is an open source project by
7
7
Coder that runs dev containers via Coder templates and your underlying
8
8
infrastructure. It can run on Docker or Kubernetes.
9
9
@@ -22,16 +22,30 @@ Coder:
22
22
A Coder admin adds a devcontainer-compatible template to Coder (envbuilder).
23
23
Then developers enter their repository URL as a [ parameter] ( ./parameters.md )
24
24
when they create their workspace.
25
- [ envbuilder ] ( https://github.com/coder/envbuilder ) clones the repo and builds a
25
+ [ Envbuilder ] ( https://github.com/coder/envbuilder ) clones the repo and builds a
26
26
container from the ` devcontainer.json ` specified in the repo.
27
27
28
+ When using the [ Envbuilder Terraform provider] ( #provider ) , a previously built
29
+ and cached image can be re-used directly, allowing instantaneous dev container
30
+ starts.
31
+
28
32
Developers can edit the ` devcontainer.json ` in their workspace to rebuild to
29
33
iterate on their development environments.
30
34
31
35
## Example templates
32
36
33
- - [ Docker] ( https://github.com/coder/coder/tree/main/examples/templates/devcontainer-docker )
34
- - [ Kubernetes] ( https://github.com/coder/coder/tree/main/examples/templates/devcontainer-kubernetes )
37
+ - [ Devcontainers (Docker)] ( https://github.com/coder/coder/tree/main/examples/templates/devcontainer-docker )
38
+ provisions a development container using Docker.
39
+ - [ Devcontainers (Kubernetes)] ( https://github.com/coder/coder/tree/main/examples/templates/devcontainer-kubernetes )
40
+ provisioners a development container on the Kubernetes.
41
+ - [ Google Compute Engine (Devcontainer)] ( https://github.com/coder/coder/tree/main/examples/templates/gcp-devcontainer )
42
+ runs a development container inside a single GCP instance. It also mounts the
43
+ Docker socket from the VM inside the container to enable Docker inside the
44
+ workspace.
45
+ - [ AWS EC2 (Devcontainer)] ( https://github.com/coder/coder/tree/main/examples/templates/aws-devcontainer )
46
+ runs a development container inside a single EC2 instance. It also mounts the
47
+ Docker socket from the VM inside the container to enable Docker inside the
48
+ workspace.
35
49
36
50
![ Devcontainer parameter screen] ( ../images/templates/devcontainers.png )
37
51
@@ -41,18 +55,58 @@ Your template can prompt the user for a repo URL with
41
55
## Authentication
42
56
43
57
You may need to authenticate to your container registry, such as Artifactory, or
44
- git provider such as GitLab, to use envbuilder . See the
45
- [ envbuilder documentation] ( https://github.com/coder/envbuilder/ ) for more
46
- information.
58
+ git provider such as GitLab, to use Envbuilder . See the
59
+ [ Envbuilder documentation] ( https://github.com/coder/envbuilder/blob/main/docs/container-registry-auth.md )
60
+ for more information.
47
61
48
62
## Caching
49
63
50
- To improve build times, dev containers can be cached. Refer to the
51
- [ envbuilder documentation] ( https://github.com/coder/envbuilder/ ) for more
52
- information.
64
+ To improve build times, dev containers can be cached. There are two main forms
65
+ of caching:
66
+
67
+ 1 . ** Layer Caching** caches individual layers and pushes them to a remote
68
+ registry. When building the image, Envbuilder will check the remote registry
69
+ for pre-existing layers. These will be fetched and extracted to disk instead
70
+ of building the layers from scratch.
71
+ 2 . ** Image Caching** caches the _ entire image_ , skipping the build process
72
+ completely (except for post-build lifecycle scripts).
73
+
74
+ Refer to the
75
+ [ Envbuilder documentation] ( https://github.com/coder/envbuilder/blob/main/docs/caching.md )
76
+ for more information.
77
+
78
+ ## Envbuilder Terraform Provider
79
+
80
+ To support resuming from a cached image, use the
81
+ [ Envbuilder Terraform Provider] ( https://github.com/coder/terraform-provider-envbuilder )
82
+ in your template. The provider will:
83
+
84
+ 1 . Clone the remote Git repository,
85
+ 2 . Perform a 'dry-run' build of the dev container in the same manner as
86
+ Envbuilder would,
87
+ 3 . Check for the presence of a previously built image in the provided cache
88
+ repository,
89
+ 4 . Output the image remote reference in SHA256 form, if found.
90
+
91
+ The above example templates will use the provider if a remote cache repository
92
+ is provided.
93
+
94
+ If you are building your own Devcontainer template, you can consult the
95
+ [ provider documentation] ( https://registry.terraform.io/providers/coder/envbuilder/latest/docs/resources/cached_image ) .
96
+ You may also wish to consult a
97
+ [ documented example usage of the ` envbuilder_cached_image ` resource] ( https://github.com/coder/terraform-provider-envbuilder/blob/main/examples/resources/envbuilder_cached_image/envbuilder_cached_image_resource.tf ) .
53
98
54
99
## Other features & known issues
55
100
56
- Envbuilder is still under active development. Refer to the
57
- [ envbuilder GitHub repo] ( https://github.com/coder/envbuilder/ ) for more
58
- information and to submit feature requests.
101
+ Envbuilder provides two release channels:
102
+
103
+ - ** Stable:** available at
104
+ [ ` ghcr.io/coder/envbuilder ` ] ( https://github.com/coder/envbuilder/pkgs/container/envbuilder ) .
105
+ Tags ` >=1.0.0 ` are considered stable.
106
+ - ** Preview:** available at
107
+ [ ` ghcr.io/coder/envbuilder-preview ` ] ( https://github.com/coder/envbuilder/pkgs/container/envbuilder-preview ) .
108
+ This is built from the tip of ` main ` , and should be considered
109
+ ** experimental** and prone to ** breaking changes** .
110
+
111
+ Refer to the [ Envbuilder GitHub repo] ( https://github.com/coder/envbuilder/ ) for
112
+ more information and to submit feature requests or bug reports.
0 commit comments