Postgres as database backend with nextcloud on docker doesn't work!?

Nextcloud version (eg, 12.0.2): docker latest
Operating system and version (eg, Ubuntu 17.04): 16.04 / docker
Apache or nginx version (eg, Apache 2.4.25): apache
PHP version (eg, 7.1):
Postgres: 10-alpine

The issue I’m facing:

The autoconfig of the nextcloud container doesn’t work if you try to run it with postgres as a database backend. E.g. the dbuser is set to oc_admin insteat to admin and the password is completely different from the container OS variable POSTGRES_PASSWORD.

There is no chance to connect to nextcloud. Neither by correcting the config.php nor by entering the correct value in the web frontend. The config.php will be overwriten.

I can connect to the database from the command line or adminer. So assume postgres and docker config are OK.

The same setting is working with mariadb as backend.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. docker run postgres:10-alpine …
  2. docker run nextcloud:latest …
  3. access nextcloud url

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

  'dbtype' => 'pgsql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => '',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'v7xon8jxfgrlma8l30q5zk2v7h92kx',

The output of env | grep POST inside the nectcloud container: