| Philip Zeyliger | 983b58a | 2025-07-02 19:42:08 -0700 | [diff] [blame^] | 1 | # Docker Containers |
| 2 | |
| 3 | ## Why!?! |
| 4 | |
| 5 | To support multiple Sketch sessions in parallel, and to give the sessions |
| 6 | isolation, each Sketch session runs in its own container. (At the end of the |
| 7 | day, the output of a Sketch session is new git commit(s).) |
| 8 | |
| 9 | ## Customization |
| 10 | |
| 11 | *Customizing Sketch's containers* |
| 12 | |
| 13 | By 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) |
| 15 | and published to |
| 16 | [https://github.com/boldsoftware/sketch/pkgs/container/sketch](https://github.com/boldsoftware/sketch/pkgs/container/sketch). |
| 17 | This container is based on Ubuntu 24.04 and contains many popular tools. Sketch |
| 18 | will install additional tools as it needs. |
| 19 | |
| 20 | Locally, Sketch creates a container image based on the default that includes |
| 21 | your working tree. This image is cached (identified by a container label that |
| 22 | is a hash of your working tree directory and the base image id) to speed up |
| 23 | starting up Sketch. (Future invocations do a "git reset" inside the image, but |
| 24 | don't need to copy over the whole git repo.) You can force re-creation with the |
| 25 | `-force-rebuild-container` flag. |
| 26 | |
| 27 | If you'd like to customize the container, specify `-base-image` and |
| 28 | point Sketch to an image you've built. We recommend layering your customizations |
| 29 | on top of our base image, but this is not strictly necessary. Sketch will then |
| 30 | add your repo on top of it, at runtime. |
| 31 | |
| 32 |  |
| 33 | |
| 34 | For example, if you want to add Node 22, you might create a Dockerfile |
| 35 | like below, and build it with `docker build -t sketch-with-node-22 - < Dockerfile.sketch`, |
| 36 | and pass it to sketch with `-base-image sketch-with-node-22`. |
| 37 | |
| 38 | ```dockerfile |
| 39 | FROM ghcr.io/boldsoftware/sketch:latest |
| 40 | |
| 41 | RUN 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. |