Skip to content

Commit 1bcfec2

Browse files
committed
add docker
1 parent 0fc50b0 commit 1bcfec2

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

examples/templates/docker/README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,42 @@ verified: true
77
tags: [docker, container]
88
---
99

10-
# docker
10+
# Remote Development on Docker Containers
1111

12-
To get started, run `coder templates init`. When prompted, select this template.
13-
Follow the on-screen instructions to proceed.
12+
Provision Kubernetes Pods as [Coder workspaces](https://coder.com/docs/coder-v2/latest) with this example template.
1413

15-
## Editing the image
14+
<!-- TODO: Add screenshot -->
1615

17-
Edit the `Dockerfile` and run `coder templates push` to update workspaces.
16+
## Prerequisites
17+
18+
### Infrastructure
19+
20+
The VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
21+
22+
```sh
23+
# Add coder user to Docker group
24+
sudo adduser coder docker
1825

19-
## code-server
26+
# Restart Coder server
27+
sudo systemctl restart coder
2028

21-
`code-server` is installed via the `startup_script` argument in the `coder_agent`
22-
resource block. The `coder_app` resource is defined to access `code-server` through
23-
the dashboard UI over `localhost:13337`.
29+
# Test Docker
30+
sudo -u coder docker ps
31+
```
2432

25-
## Extending this template
33+
## Architecture
2634

27-
See the [kreuzwerker/docker](https://registry.terraform.io/providers/kreuzwerker/docker) Terraform provider documentation to
28-
add the following features to your Coder template:
35+
> **Note**
36+
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
2937
30-
- SSH/TCP docker host
31-
- Registry authentication
32-
- Build args
33-
- Volume mounts
34-
- Custom container spec
35-
- More
38+
This template provisions the following resources:
3639

37-
We also welcome contributions!
40+
- Docker image (built by Docker socket and kept locally)
41+
- Docker container pod (ephemeral)
42+
- Docker volume (persistent on `/home/coder`)
43+
44+
This means, when the workspace restarts, any tools or files outside of the home directory are not persisted. To pre-bake tools into the workspace (e.g. `python3`), modify the container image. Alternatively, individual developers can [personalize](https://coder.com/docs/v2/latest/dotfiles) their workspaces with dotfiles.
45+
46+
### Editing the image
47+
48+
Edit the `Dockerfile` and run `coder templates push` to update workspaces.

0 commit comments

Comments
 (0)