docker に [ERROR] InnoDB: Error number 28 means 'No space left on device' と怒られた件

docker で色々作業をしているのですが、昨日突然起動できなくなり、再起動しても治らない。
とりあえずログを見てみよう

$ docker logs { コンテナID }

中を見てみるとこうなっていた

Initializing database
2018-08-14T01:23:13.466033Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-08-14T01:23:13.489498Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2018-08-14T01:23:13.489574Z 0 [ERROR] InnoDB: Write to file ./ibdata1failed at offset 0, 1048576 bytes should have been written, only 0 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
2018-08-14T01:23:13.489587Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
2018-08-14T01:23:13.489596Z 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space
2018-08-14T01:23:13.489602Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2018-08-14T01:23:14.100349Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-08-14T01:23:14.100424Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-08-14T01:23:14.100433Z 0 [ERROR] Failed to initialize builtin plugins.
2018-08-14T01:23:14.100437Z 0 [ERROR] Aborting

なるほどディスクにスペースがないから書き込めませんと怒られている。
はて、ドライブには100G程空いているし再起動したばかりだからメモリが足りない訳でもない。
docker内部のゴミが溜まっているのでは?

まずはイメージ

docker image ls

あまり出てこない。毎回起動後に消しているから溜まってなかった。

次はコンテナ

docker container ls

同じく何も出てこない。コンテナが溜まっている訳でもないのか

次にvolume

docker volume ls

うわ えぐいくらい出て来た。
絶対こいつのせいだろ

特に大切なものはないので全部消そ
(dangling=true をつけるとになっている不要なものを消してくれます)

docker volume rm $(docker volume ls -qf dangling=true) 

すっきり。
無事起動できました。

ちなみにコンテナやイメージが溜まっている場合はコマンド

docker rm $(docker ps -a -q)
docker rmi $(docker images -q)

で消せます(はず)