docker compose 「ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network」が発生した場合の対処法

docker compose 「ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network」が発生した場合の対処法

docker-compose up実行時に 「ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network」が発生した場合の対処法を記述してます。

環境

  • OS CentOS Linux release 7.9.2009 (Core)
  • docker 20.10.6
  • docker-compose 1.25.4

エラー全文

「docker-compose up」実行時に発生

docker-compose up -d

<出力結果>
Creating network "bb_default" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

原因

dockerコンテナのipアドレスが枯渇してしまっていることが原因

対処法

使用されていないネットワークを削除する。
※停止しているコンテナのネットワークも削除されます。

docker network prune

個別に削除する場合は、ネットワーク一覧を確認して、

docker network ls

以下のコマンドで、削除可能です。

docker network rm ネットワーク名