So I tried to make a docker container with wordpress & postgres using the ntninja/wordpress-postgresql image but it still trie to use MySQL to connect wordpress to the db.
My guess is that you have a local config in your ./wp folder which you mounted into the container and overwrote the db.php which sets the DB_DRIVER variable.to be psql.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'postgres');
/** MySQL database username */
define('DB_USER', 'postgres');
/** MySQL database password */
define('DB_PASSWORD', 'postgres');
/** MySQL hostname */
define('DB_HOST', 'postgres');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');```
Well, yes, it tries to connect to the database server called “postgres”, but it tries to do that as if it were a MySQL server.
Are you sure that this is the file that WordPress loads? If you checked it only on the host, try to use docker exec to get inside the container, find the file where ou expect it to be, and read the content. For example:
head -n 17 db.php
to read the first 17 lines.Then change something on the host and check the content from the container again.
Then you can temporarily delete the whole content of the file without deleting the file itself. Try to connect again and if it gives you the same message, then there is an other file somewhere where the configuration comes from and the database driver is not set.
If you get an other error mesage, for example “undefined constant”, then I have no other explanation then a bug in the image and you should contact the maintainer of the image.