I’ve had to reset my Ubuntu server a couple of times in the last year and there’s one thing I noticed that happens to my MariaDB container:

The IP address goes up by one each time. For example, it was 172.17.0.10 and now its 172.17.0.11. The ports remain the same but this breaks any app that’s using the DB since the app is still looking to connect to .10 and not .11.

I’m not quite sure if this happens to other containers (I think it might) but other containers connect using the host + port. MariaDB connects using the IP address shown in portainer. The one that matches the network bridge.

I’m not well-versed in networking and I’ve been asking about recommendations for Udemy/Coursera courses on the topic (Feel free to suggest one).

If possible, I’d like to revert the container’s Ip address back to 172.17.0.10 and prevent it from changing again, OR find a way to connect apps to the container using the localhost instead of the container IP address.

My workaround has been to go to the affected apps and point them to the new IP address when it changes but I’m hoping to find a way to eliminate the need for this. Thoughts?