I have docker running on a Debian machine. Inside docker I have an nginx container and a mysql container. In the nginx container I am running 5 websites. 3 wordpress and 2 opencart.
During wordpress and opencard installation wizards, I had to define the ip address of the mysql database. So I used 172.17.0.2 and everything was fine.
My problem is that after restarting the Debian server, the ip address of mysql changed to 172.17.0.3. So of course all the websites stopped working.
So I had to go on all the websites configuration files and change the defined ip address of mysql to fix the issue.
Inevitably at some point this will happen again. So I am wondering how to handle this issue.
Should I set static IP addresses for the containers?
Should I set up a name resolution system?
What’s a good way to handle this issue?