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.
# 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 deviceCommon 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.
docker run --tmpfs /scratch:rw,size=1g myorg/api
# or raise shared memory:
docker run --shm-size=1g myorg/apiSet the size in compose
Compose supports tmpfs size and shm_size.
services:
tests:
shm_size: "1gb"
tmpfs:
- /scratch:size=1gHow to prevent it
- Size
--tmpfs/shm_sizeto the data the workload writes. - Raise
/dev/shmfor shared-memory-heavy tools (browsers, databases). - Remember tmpfs is memory - balance size against available RAM.