Connect to a locally installed database from a Docker container

Docker has its own networking space, trying to connect to the local IP Address of the container won’t work when the database is on the host machine. Normally you would provide the hostname, ip address or use localhost if the database is installed on the same machine locally ie 127.0.0.1. But when the database is …

Docker Official PHP container how to enable PDO

The Official PHP & Apache[1] container is a great starting point for a local development environment. One thing that might trip you up is if you try to install or run queries against a database. Out of the box, PDO drivers are not enabled. This will likely resort to the following errors: [PDOException]  could not find …