How to change the Docker-compose default IP address?

If the Docker-compose default IP subnet is conflicting with your internal network hosts access, you can change the default Docker subnet by following these steps:

  1. First, you need to enter the correct folder where Docker-compose is stored. Use the following two commands:
    cd /opt/visionect 
    sudo vim docker-compose.yml
    4443933116306
  2. Next, change the subnet IP inside the docker-compose file by copying this code on the end of the docker-compose file: 
    networks:
    default:
    ipam:
    driver: default
    config:
    - subnet: 172.33.0.0/16 (enter the desired subnet)
  3. Remove the current container and build up the new container by using this command:
    sudo docker-compose down && sudo docker-compose up -d
    4444297713810

 

And that’s it!

If you wish you learn more about changing the Docker default subnet IP address, click here.