Skip to content
Latchkey

Docker tmpfs Mount "no space left on device" From a Small --tmpfs Size in CI

A tmpfs mount is memory-backed with a size cap. Writing more than that cap fails with "no space left on device" even though the host disk is empty - the limit is on the tmpfs, not the disk. The default /dev/shm (often 64 MB) trips this for shared-memory-heavy tools.

What this error means

A container writing to a tmpfs path (a --tmpfs mount, or /dev/shm) fails with no space left on device while host disk is plentiful. Common with browsers/Chromium, databases, and tools that use shared memory.

container output
# writing to a size-capped tmpfs:
write /scratch/big.tmp: no space left on device
# or Chromium in CI hitting the default 64MB /dev/shm:
[ERROR] Failed to allocate shared memory: No space left on device

Common causes

The tmpfs size limit is too small

A --tmpfs /scratch:size=64m (or default) caps how much can be written to that memory-backed mount. Exceeding the cap fails, independent of host disk free space.

Default /dev/shm is too small

Docker’s default /dev/shm is small (commonly 64 MB). Tools that use shared memory heavily (Chromium, Postgres) exhaust it and report "no space left on device".

How to fix it

Raise the tmpfs size

Give the tmpfs mount enough room for the data it holds.

Terminal
docker run --tmpfs /scratch:rw,size=1g myorg/api
# or raise shared memory:
docker run --shm-size=1g myorg/api

Set the size in compose

Compose supports tmpfs size and shm_size.

docker-compose.yml
services:
  tests:
    shm_size: "1gb"
    tmpfs:
      - /scratch:size=1g

How to prevent it

  • Size --tmpfs/shm_size to the data the workload writes.
  • Raise /dev/shm for shared-memory-heavy tools (browsers, databases).
  • Remember tmpfs is memory - balance size against available RAM.

Related guides

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