name | description | tags | ||
---|---|---|---|---|
Develop in Docker |
Run workspaces on a Docker host using registry images |
|
To get started, run coder templates init
. When prompted, select this template.
Follow the on-screen instructions to proceed.
After building and pushing an image to an image registry (e.g., DockerHub), edit the template to make the image available to users:
# Open the template
vim main.tf
Modify your file to match the following:
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:
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.
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]
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!