Configuration file contains errors

Hey there
Situation: I want to set up two Postgres DB in docker-compose with different ports (for two applications).
I write some .yml:

services:
   db1:
       image: some_image
       volumes:
         - ./configs/postgresql_1.conf:/etc/postgresql/postgresql_1.conf
       command:  postgres -c config_file=/etc/postgresql/postgresql_1.conf
   db2:
       image: some_image
       volumes:
         - ./configs/postgresql_2.conf:/etc/postgresql/postgresql_2.conf
       command:  postgres -c config_file=/etc/postgresql/postgresql_2.conf

My config file has two string:
postgresql_1.conf:
listen_adress = ā€œlocalhostā€
port = 15432
postgresql_2.conf:
listen_adress = ā€œlocalhostā€
port = 5432
And when I start command docker-compose up db1 I see this error:

LOG:  input in flex scanner failed at file "/etc/postgresql/postgresql_1.conf" line 1
FATAL:  configuration file "/etc/postgresql/postgresql_1.conf" contains errors

Please, tell me, how can I fix it?

Im not a big postgres guy, but i belive it sould be ā€œlisten_addressesā€ and not ā€œlisten_adressā€

1 Like

I agree with @terpz. The parameter would be wrong, but I think this is not the issue yet. The error message indicates that the configuration file is probably not a file. Search always for the error message. In this case ā€œpostgresql input in flex scanner failedā€

In your case it could happen if you use a wrong source path for the configuration file so docker creates a folder and mounts that.

I tried it and I got the same message.

1 Like