Docker-compose starts container report conflicts with network

  docker, question

Starting the container with docker-compose reported this error.
I don’t know why

Environmental information:

  • Docker version 17.11.0-ce-rc4
  • docker-compose version 1.18.0-rc2

Yml is as follows

FROM alpine
 RUN apk --update add curl && \
 curl -L http://sourceforge.net/projects/leanote-bin/files/2.6/leanote-linux-amd64-v2.6.bin.tar.gz/download >> \
 /usr/local/leanote-linux-amd64.bin.tar.gz && \
 apk del --purge curl && \
 rm -rf /var/cache/apk/*
 
 RUN tar -xzf /usr/local/leanote-linux-amd64.bin.tar.gz -C /usr/local
 RUN chmod +x /usr/local/leanote/bin/run.sh
 RUN hash=$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-64};  echo;  );  \
 sed -i "s/app.secret=.*$/app.secret=$hash #/" /usr/local/leanote/conf/app.conf;  \
 sed -i "s/db.host=.*$/db.host=db/" /usr/local/leanote/conf/app.conf;  \
 sed -i "s/site.url=.*$/site.url=\${SITE_URL} /" /usr/local/leanote/conf/app.conf;
 
 EXPOSE 9000
 WORKDIR  /usr/local/leanote/bin
 ENTRYPOINT ["sh", "run.sh"]
version: '2'
 
 services:
 db:
 restart: always
 image: mongo
 volumes:
 - leanote_data:/data/db
 
 server:
 environment:
 - SITE_URL="http://localhost:9000"
 depends_on:
 - db
 restart: always
 build: .
 ports:
 - "9000:9000"
 links:
 - db:mongodb
 volumes:
 leanote_data:

Execute command:

- docker-compose build
 - docker-compose up -d

After that, I made a mistake:

Creating network "leanote_default" with the default driver
 ERROR: cannot create network d3c1651b501e74a1e4ba718c0808b76461100be79b6356870caa720340689d7a (br-d3c1651b501e)  : conflicts with network a36fdb65573061a0fad22902209d2f6ca2e94b72d9bd56567356b3880077e40f (br-a36fdb655730): networks have overlapping IPv4

I haven’t met this before. I don’t know how to solve it.

  1. Remove all containers, so docker ps –all shows nothing.
  2. sudo systemctl stop docker
  3. sudo rm /var/lib/docker/network/files/local-kv.db
  4. sudo systemctl start docker