Skip to content
Latchkey

Testcontainers "no space left on device" in CI

Pulling many test images and starting containers consumes runner disk fast. When the device fills, image extraction or container writes fail with "no space left on device", and the failure can appear mid-pull.

What this error means

Setup fails with "write ...: no space left on device" while extracting an image layer or writing a container volume, often after several images have already been pulled.

Testcontainers
failed to register layer: write /var/lib/docker/...: no space left on device

Common causes

Accumulated image layers filled the disk

Multiple large test images plus build artifacts exhaust the runner disk during the job.

Leftover containers and volumes were not reaped

When cleanup (Ryuk or manual) does not run, stopped containers and volumes keep consuming space.

How to fix it

Free disk before or during the job

Prune unused images and reclaim space before starting a heavy Testcontainers suite.

Terminal
docker system prune -af --volumes
df -h

Reduce the image footprint

  1. Use smaller base images for the services under test.
  2. Pull only the images the suite actually needs.
  3. Keep Ryuk enabled (or clean up manually) so stopped containers are removed.

How to prevent it

  • Prune unused images and volumes before large test suites.
  • Prefer slim images and pull only what tests require.
  • Let Ryuk or an explicit cleanup step reclaim stopped containers.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →