blob: 38572f9f724c0dbd2b584d8926b799fe6e0a9728 [file] [log] [blame] [view]
Philip Zeyliger983b58a2025-07-02 19:42:08 -07001# Docker Containers
2
3## Why!?!
4
5To support multiple Sketch sessions in parallel, and to give the sessions
6isolation, each Sketch session runs in its own container. (At the end of the
7day, the output of a Sketch session is new git commit(s).)
8
9## Customization
10
11*Customizing Sketch's containers*
12
13By default, Sketch uses a Docker container generated by
14[https://github.com/boldsoftware/sketch/blob/main/dockerimg/Dockerfile.base](https://github.com/boldsoftware/sketch/blob/main/dockerimg/Dockerfile.base)
15and published to
16[https://github.com/boldsoftware/sketch/pkgs/container/sketch](https://github.com/boldsoftware/sketch/pkgs/container/sketch).
17This container is based on Ubuntu 24.04 and contains many popular tools. Sketch
18will install additional tools as it needs.
19
20Locally, Sketch creates a container image based on the default that includes
21your working tree. This image is cached (identified by a container label that
22is a hash of your working tree directory and the base image id) to speed up
23starting up Sketch. (Future invocations do a "git reset" inside the image, but
24don't need to copy over the whole git repo.) You can force re-creation with the
25`-force-rebuild-container` flag.
26
27If you'd like to customize the container, specify `-base-image` and
28point Sketch to an image you've built. We recommend layering your customizations
29on top of our base image, but this is not strictly necessary. Sketch will then
30add your repo on top of it, at runtime.
31
32![Docker Container Visualization](docker.svg)
33
34For example, if you want to add Node 22, you might create a Dockerfile
35like below, and build it with `docker build -t sketch-with-node-22 - < Dockerfile.sketch`,
36and pass it to sketch with `-base-image sketch-with-node-22`.
37
38```dockerfile
39FROM ghcr.io/boldsoftware/sketch:latest
40
41RUN apt-get update && \
42 apt-get install -y curl && \
43 curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
44 apt-get install -y nodejs && \
45 apt-get clean && \
46 rm -rf /var/lib/apt/lists/*
47```
48
49## Troubleshooting
50
51"no space left on device"
52
53`docker system prune -a` removes stopped containers and unused images, which usually frees up significant disk space.