name, description, tags
name | description | tags | ||
---|---|---|---|---|
Develop in Docker | Run workspaces on a Docker host using registry images |
|
docker
Getting started
Run coder templates init
and select this template. Follow the instructions that appear.
Adding/removing images
After building and pushing an image to an image registry (e.g., DockerHub), you can edit the template to make the image available to users.
Edit the template:
vim main.tf
variable "docker_image" { description = "What Docker image would you like to use for your workspace?" default = "codercom/enterprise-base:ubuntu" validation {
- condition = contains(["codercom/enterprise-base:ubuntu", "codercom/enterprise-node:ubuntu", "codercom/enterprise-intellij:ubuntu"], var.docker_image)
- condition = contains(["codercom/enterprise-base:ubuntu", "codercom/enterprise-node:ubuntu", "codercom/enterprise-intellij:ubuntu", "codercom/enterprise-golang:ubuntu"], var.docker_image)
error_message = "Invalid Docker image!"
} }
Update the template:
```sh
coder template update docker
You can also remove images from the validation list. Workspaces using older template versions will continue using the removed image until you update the workspace to the latest version.
Updating images
To reduce drift, we recommend versioning images in your registry by creating tags. To update the image tag in the template:
variable "docker_image" {
description = "What Docker image would you like to use for your workspace?"
default = "codercom/enterprise-base:ubuntu"
validation {
- condition = contains(["my-org/base-development:v1.1", "myorg-java-development:v1.1"], var.docker_image)
+ condition = contains(["my-org/base-development:v1.1", "myorg-java-development:v1.2"], var.docker_image)
error_message = "Invalid Docker image!"
}
}
Optional: Update workspaces to the latest template version:
coder ls
coder update [workspace name]
Extending this template
See the kreuzwerker/docker Terraform provider documentation to add the following features to your Coder template:
- SSH/TCP docker host
- Registry authentication
- Build args
- Volume mounts
- Custom container spec
- More
We also welcome contributions!