You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/templates/docker/README.md
+30-19Lines changed: 30 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,31 +7,42 @@ verified: true
7
7
tags: [docker, container]
8
8
---
9
9
10
-
# docker
10
+
# Remote Development on Docker Containers
11
11
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.
14
13
15
-
## Editing the image
14
+
<!-- TODO: Add screenshot -->
16
15
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
18
25
19
-
## code-server
26
+
# Restart Coder server
27
+
sudo systemctl restart coder
20
28
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
+
```
24
32
25
-
## Extending this template
33
+
## Architecture
26
34
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.
29
37
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:
36
39
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