1

I am trying to run docker-compose up -d to following docker-compose.yml file

version: '2'

services:
    php7-cli:
        build: php7-cli
        image: php7-cli
        tty: true
        volumes:
            - ../:/var/www/app
        networks:
            - my-network
networks:
    my-network:
        driver: bridge

The docker-compose build builds successfully, but if I try docker-compose up, I get the following error message:

ERROR: could not find an available, non-overlapping IPv4 address 
pool among the defaults to assign to the network

When I tried to docker network ls , I got

NETWORK ID          NAME                DRIVER              SCOPE
7c8a6c131c1b        bridge              bridge              local
9f16d3a33b4e        host                host                local
24c54a4323ed        none                null                local

I tried to remove orphan networks by docker network prune but non of those network have been removed.

then I tried to remove the bridge network manually docker network rm 7c8a6c131c1b

but I got this error

Error response from daemon: bridge is a pre-defined network and cannot be removed

here is my docker version

docker version
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:17:20 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:15:30 2018
  OS/Arch:      linux/amd64
  Experimental: false
Klamius
  • 167
  • 2
  • 10
  • 1
    Possible duplicate of [Docker "ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network"](https://stackoverflow.com/questions/43720339/docker-error-could-not-find-an-available-non-overlapping-ipv4-address-pool-am) – Nico Haase Jun 18 '18 at 13:58
  • I already tried it, but it's different as the solution there doesn't fix my issue.. thx for your comment. – Klamius Jun 18 '18 at 14:06

4 Answers4

2

The same issue was gone after renaming the network interface from ens33 to eth0. One guide used was https://www.itzgeek.com/how-tos/mini-howtos/change-default-network-name-ens33-to-old-eth0-on-ubuntu-16-04.html

Liviu Toma
  • 36
  • 3
2

YOU MUST DELETE THE bridge NETWORKS YOU DON'T USE!!!

List the docker networks

  • Look for the bridge ones associated to projects you don't use anymore
    • Those were created while running docker-compose apps in multiple directories
$ docker network ls
NETWORK ID     NAME                                        DRIVER    SCOPE
070b2051c2d6   altacv_default                              bridge    local
90269e56ef9c   arquitecture_default                        bridge    local
f04c85b27605   awesome-cv-docker_default                   bridge    local
cfdc24506a32   aws-s3-bucket-state_default                 bridge    local
51b7b53697cc   bridge                                      bridge    local
e4f4800f11bf   certs-resource_default                      bridge    local
7d760fc8a8c3   cloner_default                              bridge    local
4a161fb223cc   coverletter_default                         bridge    local
d16029047f65   distance-matrix-service_default             bridge    local
9e944ddd5da0   docker-compose-deployer_default             bridge    local
fb25db546e14   docker-compose-deployment_default           bridge    local
150cd02ad55c   docker-neo4j_default                        bridge    local
c76d6167e7b1   docker-pycobertura_default                  bridge    local

Delete the ones you don't use

  • Just delete each individual IDs that you don't want anymore...
$ docker network rm 655b6657b925 644fecac3549 6fac6fd59fe8 3d03a7df183d 40d112093fc7 32de1ea6549d 5cdd12695a4d 1e30562c7f63 58b1f6343780 e7bbf7af6dbb 4a161fb223cc 070b2051c2d6 90269e56ef9c
655b6657b925
Error response from daemon: error while removing network: network tools_supercash-data id 644fecac3549735341a482ddf330918a2050bc6ee2bcd4123d208051c836f9eb has active endpoints
6fac6fd59fe8
3d03a7df183d
40d112093fc7
...
...
...

Profit

  • Docker-compose now works as expected...
docker-compose up 

...
...
Marcello DeSales
  • 21,361
  • 14
  • 77
  • 80
1

try ifconfig

If there are too many network interfaces, then you may not stop docker correctly before. When your machine reached its maximum number of network interfaces, docker-compose cannot be upped in this situation(docker-compose up can't create new network).

Take docker-compose for example. Each time we run docker-compose up, we create a network interface and this interface should be deleted when we run docker-compose down. docker-compose down stops containers and removes containers, networks, volumes, and images created by up.

Solution: reboot

Community
  • 1
  • 1
Ryan
  • 11
  • 3
1

I have the same issue.

In my case I am using a VPN client named FortiClient VPN. Disconnecting the VPN makes docker-compose the ability again to create the default network.

pfRodenas
  • 326
  • 1
  • 2
  • 12