KKIMS on-site docs
Your workstation

Docker and buildx

Install Docker Engine (Linux) or Docker Desktop (macOS, Windows with WSL 2) with buildx and Compose, give it enough memory and disk, build linux/amd64 images on Apple silicon, and restart it when it gets stuck.

Docker runs the local stand-ins (PostgreSQL 18, Keycloak, an S3 stand-in, Jenkins), builds the KIMS v2 image, and hosts the kind cluster for the rehearsal. You need:

Part Version Used for
Docker Engine or Docker Desktop Engine 24 or later Everything
buildx (BuildKit) Any recent docker buildx build of the image, multi-architecture
Compose v2 (docker compose, with a space) Any recent local/docker-compose.yml

On site, Docker is needed only on the Jenkins agent (see Jenkins agent). On your laptop it is for the local rehearsal.

#Install

Docker Engine from Docker's own repository (the distribution's docker.io package is often old and lacks the buildx and compose plugins).

Ubuntu (Debian is the same with debian in place of ubuntu in the two URLs):

bash
sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Fedora:

bash
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker

RHEL, Rocky and Alma: the same, with the repository file https://download.docker.com/linux/rhel/docker-ce.repo (on dnf 4, sudo dnf config-manager --add-repo <URL>).

Amazon Linux 2023: sudo dnf install -y docker && sudo systemctl enable --now docker. Its package has no buildx or compose plugin; install buildx from https://github.com/docker/buildx/releases into ~/.docker/cli-plugins/docker-buildx (and chmod +x it).

Run docker without sudo (log out and back in afterwards):

bash
sudo usermod -aG docker "$USER"

Membership of the docker group is equivalent to root on that machine. On a shared machine, keep using sudo docker instead.

Docker Desktop for Linux also exists, but Docker Engine is the usual choice on Linux.

Docker Desktop, from Homebrew:

bash
brew install --cask docker-desktop

(The cask used to be called docker; that name still works and points here.) Or download it from https://docs.docker.com/desktop/setup/install/mac-install/, choosing Apple silicon or Intel chip to match your Mac (Apple menu, About This Mac, "Chip").

Open Docker from Applications once, accept the agreement and wait for "Docker Desktop is running". Docker Desktop includes buildx, Compose and a kubectl.

Alternatives that also work with these commands: OrbStack and Colima. The project was built with Docker Desktop.

Docker Desktop with the WSL 2 backend:

powershell
winget install -e --id Docker.DockerDesktop

Or download Docker Desktop Installer.exe from https://docs.docker.com/desktop/setup/install/windows-install/ and run it, keeping "Use WSL 2 instead of Hyper-V" ticked.

Requirements: 64-bit Windows 10 22H2 (build 19045) or Windows 11 23H2 (build 22631) or later, Pro, Enterprise or Education (Home works for Linux containers), hardware virtualisation enabled in the BIOS/UEFI, WSL 2.1.5 or later, and at least 8 GB of RAM (16 GB is more comfortable for this project). If WSL is missing or old, in an Administrator PowerShell:

powershell
wsl --install --no-distribution
wsl --update

Then restart Windows. Start Docker Desktop from the Start menu, accept the agreement and wait for "Engine running" in the bottom-left corner.

If you installed "for all users" and your everyday account is not the administrator account, Docker Desktop may ask for your user to be in the docker-users group: net localgroup docker-users <YOUR_USER> /add in an Administrator prompt, then sign out and in.

Note

Docker Desktop licence. Docker Desktop is free for personal use, education, non-commercial open source and businesses with fewer than 250 employees and less than USD 10 million annual revenue. Larger organisations need a paid subscription for commercial use. Check which applies to your employer. Docker Engine on Linux has no such condition.

#Check

text
docker version --format "{{.Server.Version}}"
docker buildx version
docker compose version
docker run --rm hello-world

You should see a server version (for example 29.1.2; 24 or later), github.com/docker/buildx v0.x..., Docker Compose version v2.x..., and Hello from Docker! from the last command.

An error mentioning dockerDesktopLinuxEngine (Windows) or Cannot connect to the Docker daemon at unix:///.../docker.sock (macOS, Linux) means the engine is not running yet. Start Docker Desktop and wait, or sudo systemctl start docker on Linux.

Check the architecture Docker runs natively:

text
docker info --format "{{.Architecture}}"

x86_64 means amd64; aarch64 means arm64 (every Apple silicon Mac, and Windows or Linux on Arm).

#Resources: memory and disk

#How much it needs

Use Memory for Docker Free disk for Docker
Local services only (Postgres, Keycloak, S3) 4 GB 5 GB, plus the data bundle (about 1 GB once loaded into the S3 stand-in and Postgres)
Building the image 6 GB 10 GB (build cache)
kind cluster with the chart 6 GB 5 GB more
Local Jenkins running a full three-language site build 8 GB or more about 10 GB of build workspace

#Setting it

Docker Engine uses the host's memory directly; there is nothing to set. Disk usage is under /var/lib/docker; check its filesystem with df -h /var/lib/docker.

Docker Desktop, Settings (gear icon), Resources, Advanced: set Memory limit to at least 8 GB and Virtual disk limit to at least 64 GB, then Apply & restart.

With the WSL 2 backend, Docker's memory is set by WSL, not by Docker Desktop. Create or edit C:\Users\<you>\.wslconfig:

text
[wsl2]
memory=8GB

Then in PowerShell wsl --shutdown, and start Docker Desktop again. Disk usage lives in a virtual disk file under %LOCALAPPDATA%\Docker\wsl\; make sure drive C: has the free space.

Warning

A full site build in the local Jenkins needs about 10 GB inside Docker, and runs out of memory with too many workers. On the engineer's Windows laptop Docker Desktop reported 12 CPUs but only 6.6 GiB of memory, next build started eleven workers, and the export died with ENOMEM. The fix, KIMS_BUILD_WORKERS=3, and the Jenkins workspace on a Docker volume instead of a Windows folder (on a bind mount the build spent most of 90 minutes on file I/O and timed out) need the windows-fixes commits, not yet merged into main. On main the local Jenkins uses a host folder (.local-jenkins-workspace) and Next's default worker count. See Local Jenkins.

#Freeing disk space

text
docker system df

shows what uses space. To reclaim it:

text
docker builder prune -f
docker image prune -f

The first deletes the build cache (the next image build is slower), the second deletes dangling images. Do not run docker volume prune or docker system prune --volumes unless you mean to: the local database, S3 stand-in, Keycloak and Jenkins data live in named volumes (kims-v2_postgres-data, kims-v2_s3-data, kims-v2_jenkins-home and others), and those commands delete them. Stop and reset is the controlled way.

#buildx and multi-architecture images

#What the project builds

The Dockerfile is written so that a multi-architecture build needs no emulation: the heavy stages (npm ci, next build, esbuild) run on the build machine's own architecture (--platform=$BUILDPLATFORM), only sharp's native files are fetched for the target, and the final stage runs no commands. Jenkins builds linux/amd64,linux/arm64 with a docker-container builder named kims-builder.

#Building on your laptop

For the local kind rehearsal, build for your own machine and load it into Docker:

text
docker buildx build -f deploy/Dockerfile --load -t kims-v2:dev .

Run from the repo. Expect 5 to 15 minutes the first time. --load only works for a single architecture.

#Apple silicon: building linux/amd64

On an Apple silicon Mac the default build is linux/arm64, which is right for a local kind cluster on that Mac. To build the amd64 image that KIMS's x86 nodes would run (for example to compare with Jenkins), name the platform:

bash
docker buildx build -f deploy/Dockerfile --platform linux/amd64 -t kims-v2:dev-amd64 --load .

That image cannot run in a kind cluster on the same Mac (the kind node is arm64). To run amd64 containers at all on Apple silicon, turn on Docker Desktop, Settings, General, Use Rosetta for x86_64/amd64 emulation on Apple Silicon.

To build both architectures at once, as Jenkins does, you need a docker-container builder and a registry to push to (a multi-architecture image cannot be --loaded):

bash
docker buildx create --name kims-builder --driver docker-container --use
docker buildx build -f deploy/Dockerfile --platform linux/amd64,linux/arm64 -t <REGISTRY>/kims/kims-v2:test --push .

You will rarely need this on a laptop: the platform job does it.

#When Docker gets stuck

#Symptoms

  • Containers stay at Created and never start (seen on the engineer's Mac).
  • docker commands hang.
  • docker compose up waits forever on a health check that passed before.

#Restart it

bash
sudo systemctl restart docker

Docker menu-bar icon (the whale), Restart. If the menu does not respond: killall Docker && open -a Docker.

Docker Desktop's tray icon (the whale), Restart. If it does not respond, in PowerShell:

powershell
wsl --shutdown

Then start Docker Desktop again from the Start menu.

Wait until it says the engine is running, then docker ps. Your volumes and images are kept. In the engineer's case a restart of Docker Desktop was the whole fix.

#If it goes wrong

What you see Cause Fix
permission denied while trying to connect to the Docker daemon socket (Linux) Not in the docker group, or not logged out since sudo usermod -aG docker "$USER", log out and in; or use sudo
error during connect: ... dockerDesktopLinuxEngine (Windows) Docker Desktop not running Start it and wait for "Engine running"
WSL 2 installation is incomplete / WSL update failed WSL missing or old wsl --install --no-distribution, wsl --update, restart Windows
Hardware assisted virtualization and data execution protection must be enabled in the BIOS Virtualisation off in firmware Enable Intel VT-x / AMD-V (SVM) in the BIOS/UEFI; ask IT on a managed laptop
docker: 'buildx' is not a docker command Linux package without the plugin sudo apt install docker-buildx-plugin (or the release binary on Amazon Linux)
docker: 'compose' is not a docker command Old Compose v1 only (docker-compose) Install docker-compose-plugin; use docker compose with a space
no space left on device during a build Docker's disk is full Freeing disk space; raise the disk limit
ENOMEM or exit code 137 in a site build or next build Docker's memory is too small for the number of workers More memory (Setting it); see the warning above about KIMS_BUILD_WORKERS
exec format error when a container starts Image built for the other architecture Build without --platform, or for the machine's own architecture
ERROR: docker exporter does not currently support exporting manifest lists --load with two platforms Build one platform with --load, or --push both
toomanyrequests: You have reached your pull rate limit Docker Hub anonymous limits docker login with a free Docker account, or wait
Containers stuck at Created Docker Desktop's VM in a bad state Restart it

#Sources

Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.