I'm creating a lamp stack docker-compose.
for get the ip of the mysql container on my machine, i execute these command for get it
docker ps --format \
"table {{.ID}}\t{{.Status}}\t{{.Names}}"
docker inspect -f \
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
<the container id>
and when i get the mysql container id, I change my php connection file as this
$servername = "<the container ip>:3306";
$username = "user";
$password = "password";
$dbname = "db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
Did there are a way for does this automatically for when I deploy it to my server for I doesn't do the change it by myself ?
Thank for your response