LoginSignup
1
1

【docker】コンテナ立ち上げ時、ディスク容量が無いため起動できない問題を解決する

Last updated at Posted at 2023-07-12

はじめに

いつも通りコンテナを立ち上げようと、docker-compose up -dを実行したところエラーが発生しました。

発生したエラー.
2023-07-12T09:55:44.559655Z 1 [ERROR] [MY-012144] [InnoDB] posix_fallocate(): Failed to preallocate data for file mysql.ibd, desired size 16384 bytes. Operating system error number 28. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information.
2023-07-12T09:55:44.560107Z 1 [Warning] [MY-012638] [InnoDB] Retry attempts for writing partial data failed.
2023-07-12T09:55:44.560325Z 1 [ERROR] [MY-012639] [InnoDB] Write to file mysql.ibd failed at offset 884736, 16384 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.
2023-07-12T09:55:44.560372Z 1 [ERROR] [MY-012640] [InnoDB] Error number 28 means 'No space left on device'
2023-07-12T09:55:44.560409Z 1 [Warning] [MY-012145] [InnoDB] Error while writing 16384 zeroes to mysql.ibd starting at offset 884736
2023-07-12T09:55:44.561115Z 0 [Warning] [MY-012638] [InnoDB] Retry attempts for writing partial data failed.
2023-07-12T09:55:44.561211Z 0 [ERROR] [MY-012888] [InnoDB] Cannot resize redo log file ./#innodb_redo/#ib_redo29_tmp to 96 MB (Failed to set size)

原因となるエラーの箇所を一部抜粋したものになります
[ERROR]が至る場所で出ていて、どの部分でググれば良いのかかなり苦戦しましたね。。

その中でも、
Check that the disk is not full or a disk quota exceeded. とか、
Check also that the disk is not full or a disk quota exceeded. とか、
Error number 28 means 'No space left on device'

この辺りが今回の原因で解決を得るためのエラー文になりそうでした

[結論] 解決に至った方法

$ docker rmi $(docker images -q)

※ これは、意図していないimageを削除しかねないので注意が必要です

このコマンドでは、全てのイメージidを取得して全て削除します

それに対し、
docker image prune では使用されていないイメージを削除し、
使用されているイメージや、使用されているイメージと依存関係のあるイメージは削除されません

そのため、基本的にはdocker image pruneを使用する方が安全かと思います

解決しなかった

$ docker image prune
$ docker volume prune
$ docker container prune

これでも解決する場合は大いにあるかと思いました。
しかし、私の場合はそれ以上にディスク容量が圧迫され、大幅に減らす必要があったため
解決しなかったのかと思います

おまけ

ディスクの使用量を確認できるみたい

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          12        3         6.798GB   5.67GB (83%)
Containers      6         6         12B       0B (0%)
Local Volumes   7         5         8.011GB   1.22GB (15%)
Build Cache     869       0         30.88GB   30.88GB

キャッシュも30GBたまってたので綺麗にしました
(これだけでも解決できたのでは?)

$ docker builder prune
・
・
・
Total reclaimed space: 30.88GB
$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          12        3         6.798GB   5.67GB (83%)
Containers      6         6         12B       0B (0%)
Local Volumes   7         5         8.011GB   1.22GB (15%)
Build Cache     151       0         0B        0B

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1