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:
- First, you need to enter the correct folder where Docker-compose is stored. Use the following two commands:
sudo vim docker-compose.yml
- Next, change the subnet IP inside the docker-compose file by copying this code on the end of the docker-compose file:
- subnet: 18.104.22.168/16 (enter the desired subnet)
- Remove the current container and build up the new container by using this command:
sudo docker-compose down && sudo docker-compose up -d
And that’s it!
If you wish you learn more about changing the Docker default subnet IP address, click here.