# Return to the knowledge base

Change docker default interface IP & Subnet

Docker uses the default 172.17. 0.0/16 subnet for container networking. If your network devices are in this subnet block, you will experience an IP conflict when the docker service or a container is started. To avoid IP conflict, you can change the default docker subnet.

We need to change 2 parts:

  • Default docker0 interface
  • Your docker project

You can’t overlap the interface with your project, therefor we need 2 different subnets.
In my case for the docker0 container and for my docker project

Update your docker to the latest version

sudo apt-get update
sudo apt upgrade docker-ce

Remove & Stop existing containers

sudo docker stop $(docker ps -q)
sudo docker rm -f $(docker ps -aq)
sudo docker network prune -f

Stop docker

sudo systemctl stop docker.socket
sudo systemctl stop docker

Change or Create the daemon config file

sudo nano /etc/docker/daemon.json

Change your network in the compose file

When the project starts and you bridged the network you will see when you type ip route that Docker will still create an extra network.

"bip": ""

Therefor we also have to specify the other network in the compose file, this can not overlap with the docker0 network

    driver: bridge
        driver: default
            - subnet: ""
              gateway: ""

Reboot the server

sudo reboot

Yes, keep me informed

Connect with us on LinkedIn to stay updated on the latest happenings, news, and exciting developments at Slurp’it. Just click the button below to follow us and be a part of our professional network.