I am running a PHP dev env in different docker containers. Unfortunately I do not succeed in connecting from the PHP code to my database container by using PDO.
In a different container I am running PHPMyAdmin which can connect to the database.
The same setup works perfectly on the same docker environment but for another project with a different docker-compose file and different names.
I was able to reproduce the error on a brand new virtual machine successfully
The code for that environment is available on GitHub.
And I already discussed the error message on Stackoverflow - unfortunately not successfull.
In my environment everything works fine. But when I try to fire up another environment from the same docker compose file but with other namings of the services I am not able to connect from my PHP code to the database. My dedicated PHPMyAdmin container can connect but my own code, based on PDO, cannot connect.