DockerでIPアドレスが足りなくなったとき

投稿者: | 2020年6月22日

現象

docker-composeを使ってコンテナを立ち上げようとしたところ下記のようなエラーが表示されました。

failed to create network xxxx_default: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

docker-composeのバージョンが古いと下記のようなエラーになります。

Creating network "xxxx_default" with the default driver
ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network

原因

多数のコンテナを使っていると、割り当てられるIPアドレスが足りなくなるようです。

解決方法

下記のコマンドで割り当てられているIPアドレスをクリアして解決です。

docker network prune