Skip to content

Commit 40863c0

Browse files
authored
chore: add Disclaimer for docker-based templates (#324)
1 parent d9b223a commit 40863c0

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

registry/coder-labs/templates/docker-build/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ tags: [docker, container, dockerfile]
88

99
# Remote Development on Docker Containers (Build from Dockerfile)
1010

11+
> [!NOTE]
12+
> This template is designed to be a starting point for testing purposes.
13+
> In a production environment, you would want to move away from storing the Dockerfile in-template and move towards using a centralized image registry.
14+
1115
Build and provision Docker containers from a Dockerfile as [Coder workspaces](https://coder.com/docs/workspaces) with this example template.
1216

1317
This template builds a custom Docker image from the included Dockerfile, allowing you to customize the development environment by modifying the Dockerfile rather than using a pre-built image.
@@ -18,7 +22,22 @@ This template builds a custom Docker image from the included Dockerfile, allowin
1822

1923
### Infrastructure
2024

21-
The VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
25+
#### Running Coder inside Docker
26+
27+
If you installed Coder as a container within Docker, you will have to do the following things:
28+
29+
- Make the the Docker socket available to the container
30+
- **(recommended) Mount `/var/run/docker.sock` via `--mount`/`volume`**
31+
- _(advanced) Restrict the Docker socket via https://github.com/Tecnativa/docker-socket-proxy_
32+
- Set `--group-add`/`group_add` to the GID of the Docker group on the **host** machine
33+
- You can get the GID by running `getent group docker` on the **host** machine
34+
35+
If you are using `docker-compose`, here is an example on how to do those things (don't forget to edit `group_add`!):
36+
https://github.com/coder/coder/blob/0bfe0d63aec83ae438bdcb77e306effd100dba3d/docker-compose.yaml#L16-L23
37+
38+
#### Running Coder outside of Docker
39+
40+
If you installed Coder as a system package, the VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
2241

2342
```sh
2443
# Add coder user to Docker group

registry/coder/templates/docker-devcontainer/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,26 @@ Provision Devcontainers as [Coder workspaces](https://coder.com/docs/workspaces)
1414

1515
### Infrastructure
1616

17-
Coder must have access to a running Docker socket, and the `coder` user must be a member of the `docker` group:
17+
#### Running Coder inside Docker
1818

19-
```shell
19+
If you installed Coder as a container within Docker, you will have to do the following things:
20+
21+
- Make the the Docker socket available to the container
22+
- **(recommended) Mount `/var/run/docker.sock` via `--mount`/`volume`**
23+
- _(advanced) Restrict the Docker socket via https://github.com/Tecnativa/docker-socket-proxy_
24+
- Set `--group-add`/`group_add` to the GID of the Docker group on the **host** machine
25+
- You can get the GID by running `getent group docker` on the **host** machine
26+
27+
If you are using `docker-compose`, here is an example on how to do those things (don't forget to edit `group_add`!):
28+
https://github.com/coder/coder/blob/0bfe0d63aec83ae438bdcb77e306effd100dba3d/docker-compose.yaml#L16-L23
29+
30+
#### Running Coder outside of Docker
31+
32+
If you installed Coder as a system package, the VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
33+
34+
```sh
2035
# Add coder user to Docker group
21-
sudo usermod -aG docker coder
36+
sudo adduser coder docker
2237

2338
# Restart Coder server
2439
sudo systemctl restart coder

registry/coder/templates/docker/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@ Provision Docker containers as [Coder workspaces](https://coder.com/docs/workspa
1616

1717
### Infrastructure
1818

19-
The VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
19+
#### Running Coder inside Docker
20+
21+
If you installed Coder as a container within Docker, you will have to do the following things:
22+
23+
- Make the the Docker socket available to the container
24+
- **(recommended) Mount `/var/run/docker.sock` via `--mount`/`volume`**
25+
- _(advanced) Restrict the Docker socket via https://github.com/Tecnativa/docker-socket-proxy_
26+
- Set `--group-add`/`group_add` to the GID of the Docker group on the **host** machine
27+
- You can get the GID by running `getent group docker` on the **host** machine
28+
29+
If you are using `docker-compose`, here is an example on how to do those things (don't forget to edit `group_add`!):
30+
https://github.com/coder/coder/blob/0bfe0d63aec83ae438bdcb77e306effd100dba3d/docker-compose.yaml#L16-L23
31+
32+
#### Running Coder outside of Docker
33+
34+
If you installed Coder as a system package, the VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group:
2035

2136
```sh
2237
# Add coder user to Docker group

0 commit comments

Comments
 (0)