Skip to content

Commit d9941eb

Browse files
authored
chore: add docker group command (coder#949)
* chore: add docker group command * chore: add docker-compose * chore: combine compose commands
1 parent b8bca0d commit d9941eb

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

admin/workspace-management/cvms/images.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ experience, use [systemd](#systemd) and register the `docker` service so
4141
`dockerd` runs automatically during initialization.
4242

4343
The following snippet shows how your image can register the `docker` services in
44-
its Dockerfile.
44+
its Dockerfile. For a full example, [see our `enterprise-base` image for a full example](https://github.com/coder/enterprise-images/blob/main/images/base/Dockerfile.ubuntu).
4545

4646
```Dockerfile
4747
FROM ubuntu:20.04
@@ -59,6 +59,21 @@ RUN systemctl enable docker
5959

6060
# use systemd as the init
6161
RUN ln -s /lib/systemd/systemd /sbin/init
62+
63+
# Add docker-compose
64+
RUN curl -L "https://github.com/docker/compose/releases/download/2.4.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
65+
&& chmod +x /usr/local/bin/docker-compose
66+
67+
# Add a user `coder` so that you're not developing as the `root` user
68+
RUN useradd coder \
69+
--create-home \
70+
--shell=/bin/bash \
71+
--groups=docker \
72+
--uid=1000 \
73+
--user-group && \
74+
echo "coder ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers.d/nopasswd
75+
76+
USER coder
6277
```
6378

6479
## Private registries

0 commit comments

Comments
 (0)