Use PhpPgMyAdmin to detect your docker postgres instances
<?php
# phppgmyadmin/conf/config.inc.php
(...)
// Docker postgres connections
$server_i = 1;
$containers = explode("\n", trim(`docker ps`));
array_shift($containers);
foreach ($containers as $cid) {
if (!preg_match('/postgres/', $cid)) { continue; }
$cid = substr($cid, 0, 12);
$container = json_decode(`docker inspect {$cid}`);
if ($container) {
$container = $container[0];
$port = array_keys((Array)$container->NetworkSettings->Ports)[0];
$port = +explode('/', $port, 2)[0];
$conf['servers'][$server_i]['desc'] = substr($container->Name, 1);
$conf['servers'][$server_i]['host'] = $container->NetworkSettings->IPAddress;
$conf['servers'][$server_i]['port'] = $port;
$conf['servers'][$server_i]['sslmode'] = 'allow';
$conf['servers'][$server_i]['defaultdb'] = 'template1';
$conf['servers'][$server_i]['pg_dump_path'] = '/usr/bin/pg_dump';
$conf['servers'][$server_i]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
$server_i++;
}
}