Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31aaa1e

Browse files
authored
docs: Update Docker docs and docker-compose, mention group-add (#4237)
1 parent 59cc4a2 commit 31aaa1e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docker-compose.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ services:
1616
# Alternatively, you can enable CODER_TUNNEL for
1717
# proof-of-concept deployments.
1818
CODER_TUNNEL: "${CODER_TUNNEL:-false}"
19+
# If the coder user does not have write permissions on
20+
# the docker socket, you can uncomment the following
21+
# lines and set the group ID to one that has write
22+
# permissions on the docker socket.
23+
#group_add:
24+
# - "998" # docker group on host
1925
volumes:
2026
- /var/run/docker.sock:/var/run/docker.sock
2127
depends_on:

docs/install/docker.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@ the following command:
1111

1212
```sh
1313
export CODER_DATA=$HOME/.config/coderv2-docker
14+
export DOCKER_GROUP=$(getent group docker | cut -d: -f3)
1415
mkdir -p $CODER_DATA
1516
docker run --rm -it \
1617
-e CODER_TUNNEL=true \
1718
-v $CODER_DATA:/home/coder/.config \
1819
-v /var/run/docker.sock:/var/run/docker.sock \
20+
--group-add $DOCKER_GROUP \
1921
ghcr.io/coder/coder:latest
2022
```
2123

24+
**<sup>Note:</sup>** <sup>Coder runs as a non-root user, we use `--group-add` to
25+
ensure Coder has permissions to manage Docker via `docker.sock`. If the host
26+
systems `/var/run/docker.sock` is not group writeable or does not belong to the
27+
`docker` group, the above may not work as-is.</sup>
28+
2229
Coder configuration is defined via environment variables.
2330
Learn more about Coder's [configuration options](../admin/configure.md).
2431

@@ -55,7 +62,7 @@ an PostgreSQL container and volume.
5562
3. Start Coder with `docker-compose up`:
5663

5764
In order to use cloud-based templates (e.g. Kubernetes, AWS), you must have an external URL that users and workspaces will use to connect to Coder.
58-
65+
5966
For proof-of-concept deployments, you can use [Coder's tunnel](../admin/configure.md#tunnel):
6067

6168
```sh
@@ -74,7 +81,7 @@ an PostgreSQL container and volume.
7481

7582
> Without `CODER_ACCESS_URL` or `CODER_TUNNEL` set, Coder will bind to `localhost:7080`. This will only work for Docker-based templates.
7683
77-
4. Visit the web ui via the configured url. You can add `/login` to the base url to create the first user via the ui.
84+
4. Visit the web ui via the configured url. You can add `/login` to the base url to create the first user via the ui.
7885

7986
5. Follow the on-screen instructions log in and create your first template and workspace
8087

0 commit comments

Comments
 (0)