2023-10-17 17:47:12 +03:00
|
|
|
# Your first template
|
|
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
The fastest way to create a template is with the template builder. The builder
|
|
|
|
|
guides you through selecting base infrastructure, adding modules for IDEs and
|
|
|
|
|
tools, and configuring your template, all without writing Terraform. Once your
|
|
|
|
|
template is up and running, you can edit it in the Coder dashboard. Coder
|
2023-10-17 17:47:12 +03:00
|
|
|
handles versioning for you so you can publish official updates or revert to
|
|
|
|
|
previous versions.
|
|
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
In this tutorial, you'll create your first template from the Docker base
|
|
|
|
|
template using the template builder.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
|
|
|
|
## Before you start
|
|
|
|
|
|
2024-10-05 08:52:04 -07:00
|
|
|
Use the [previous section](./local-deploy.md) of this guide to set up
|
|
|
|
|
[Docker](https://docs.docker.com/get-docker/) and [Coder](../install/cli.md) on
|
|
|
|
|
your local machine to continue.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
|
|
|
|
## 1. Log in to Coder
|
|
|
|
|
|
2024-10-05 08:52:04 -07:00
|
|
|
In your web browser, go to your Coder dashboard using the URL provided during
|
|
|
|
|
setup to log in.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
## 2. Open the template builder
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
Select **Templates** then **New Template**. The template builder opens and
|
|
|
|
|
displays a list of base infrastructure templates.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|

|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
## 3. Select a base template
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
Select the **Docker Containers** base template. This provides a working
|
|
|
|
|
Docker-based workspace with the Coder agent pre-configured.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
## 4. Add modules (optional)
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
The builder shows a list of available modules grouped by category. You can add
|
|
|
|
|
IDEs like **code-server** (VS Code in the browser) or tools like **git-clone**.
|
|
|
|
|
For your first template, you can skip this step and add modules later.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|

|
2024-10-05 08:52:04 -07:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
Select **Continue** to proceed.
|
2024-10-05 08:52:04 -07:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
## 5. Create your template
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|
On the final step, fill in **Name** and **Display name**, then select
|
|
|
|
|
**Create Template**. Coder composes the Terraform configuration, validates it,
|
|
|
|
|
and creates your template.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
2026-07-06 11:15:59 -04:00
|
|
|

|
2023-10-17 17:47:12 +03:00
|
|
|
|
|
|
|
|
## 6. Modify your template
|
|
|
|
|
|
|
|
|
|
Now you can modify your template to suit your team's needs.
|
|
|
|
|
|
|
|
|
|
Let's replace the `golang` package in the Docker image with the `python3`
|
|
|
|
|
package. You can do this by editing the template's `Dockerfile` directly in your
|
|
|
|
|
web browser.
|
|
|
|
|
|
|
|
|
|
In the Coder dashboard, select **Templates** then your first template.
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
In the drop-down menu, select **Edit files**.
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Expand the **build** directory and select **Dockerfile**.
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Edit `build/Dockerfile` to replace `golang` with `python3`.
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Select **Build template** and wait for Coder to prepare the template for
|
|
|
|
|
workspaces.
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Select **Publish version**. In the **Publish new version** dialog, make sure
|
2024-09-11 12:25:07 +02:00
|
|
|
**Promote to active version** is checked then select **Publish**.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
Now when developers create a new workspace from this template, they can use
|
|
|
|
|
Python 3 instead of Go.
|
|
|
|
|
|
|
|
|
|
For developers with workspaces that were created with a previous version of your
|
|
|
|
|
template, Coder will notify them that there's a new version of the template.
|
|
|
|
|
|
2024-10-05 08:52:04 -07:00
|
|
|
You can also handle
|
|
|
|
|
[change management](../admin/templates/managing-templates/change-management.md)
|
|
|
|
|
through your own repo and continuous integration.
|
2023-10-17 17:47:12 +03:00
|
|
|
|
|
|
|
|
## Next steps
|
|
|
|
|
|
2024-10-05 08:52:04 -07:00
|
|
|
- [Setting up templates](../admin/templates/creating-templates.md)
|