PostgreSQL Docker and "No space left on device"
I was trying to launch a PostgreSQL Docker container and was seeing it fail with the following error:
initdb: error: could not create directory "/var/lib/postgresql/data/pg_wal": No space left on device
I checked my disk usage and I had plenty of storage left, almost half. Did an online search and discovered that Docker caps the amount of storage set aside for volumes. And that was set criminally low, about 119.21 GB or so, which is 6% of what’s available:
Raising the storage to 1 TB seemed to resolve the problem.
Kind of figured we’ve learnt from the issues with capping resources like this. Anyone who remembers the bad old days of adjusting the heap size of Java would surely get PTSD from dealing with this sort of rubbish. I know I did. I understand that for a shared instances or production setups, fair enough: cap the storage so it won’t go out of bounds. But for a standard laptop setup, just use all resources that’s available to you.
Anyway, if anyone else using PostgreSQL in Docker encounters this, try the method above. You can find it by opening Docker Desktop, then going to Settings → Resources.