Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has Docker volume run out of space?

Dockerized database will no longer start because...

FATAL:  could not write lock file "postmaster.pid": No space left on device

There are hundreds of Gb available on my hard-disk although I do believe something has run out of space. This problem first cropped up after a couple of attempts at restoring a 45Gb database from backup. During that time my Docker.qcow2 file ballooned to 60Gb. Does Hypervisor have some limit on the size of that VM file? Using Docker for Mac.

EDIT: Just want to make clear that my usecase genuinely required that much diskspace but yes if you haven't tried prune then first try the most upvoted answer.

It seems to be a clue that I somehow get the same error when I remove these lines from docker-compose.yml:

volumes:
  - website_database_volume:/var/lib/postgresql/data

(and yes I sanity checked I was in the right part of the file by messing with other attributes)

Output of of docker system df

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              21                  16                  4.58 GB             -7.44e+09 B (-162%)
Containers          827                 3                   28.69 MB            28.69 MB (99%)
Local Volumes       5                   5                   57.02 GB            0 B (0%)
like image 663
Adamantish Avatar asked Mar 09 '17 19:03

Adamantish


2 Answers

Solution that worked for me from the docker-for-mac issue (hundreds of comments so to save you reading them all):

docker system prune -a

End result

.... deleted: sha256:c9d802a5c476d3100dfd62787867736f57177840605c6604ec845b9156e04603 deleted: sha256:f29af3b4c73780af53dd27f68cde554260185c89b3f26106491a7e29c1bca2f1 deleted: sha256:ea52b02280d9e96b22f25cc8f569c72e90ca4297f0c5ca3076f22e28d0c2f9b4 deleted: sha256:1e1c2966def79a1a2745bbb8589fbb6de6dcbbef049fa075f8974655f2ac0e7a deleted: sha256:2e37924689f1bcd52df62e77fa37584fcb2d787dfa3787b71e7910f479455de9 deleted: sha256:ce5059dd22f090e710f834101b6c33b0567e6e8c13dcaed344f6e2d54678dea5 deleted: sha256:d48a21f58ae245ccdebc29d8f01fae42ce85842b4ea4de32902fb55a0a00ee03 deleted: sha256:5983b1164ccb0e6ac7a2dab6a6e29efaa11fcdf1350e91ff2aab919c31d63934 deleted: sha256:6049f38e8c033dea5e5b7ee7abd5b1af20e5c77f570752b560e49e51c35cc4df deleted: sha256:d2987ea1ae6dfc8f2f3b07fd4e5802feab53e95c1590f12453166d2f57d2f301 deleted: sha256:8f3411639785500fb0133ca55d2639e0661ceb439417574adf084341905dd3d0 deleted: sha256:b7b7fbb077245d146b83458cb5099b22cf667f82342d7eed0b16f8e5f641149f deleted: sha256:d0a6c2235a31bee1812d9db1afdf5ec5ff5eec53218e05d328db9c09bfded893 deleted: sha256:be2878c078e2df267e68687181f8373a31853f79086cac36edbf81ce07b40b28 deleted: sha256:fe4c16cbf7a4c70a5462654cf2c8f9f69778db280f235229bd98cf8784e878e4 Total reclaimed space: 53.43GB

NB: this also deleted some base images I hadn't used in a while so be prepared for some collateral damage.

like image 125
jeznag Avatar answered Sep 21 '22 12:09

jeznag


It turns out to be a known issue which has a fix currently in beta: https://github.com/docker/for-mac/issues/371#issuecomment-262826610

Thanks to one of the hyperkit contributors for pointing me in that direction.

like image 35
Adamantish Avatar answered Sep 21 '22 12:09

Adamantish