I have following build:
db:
build: docker-db
ports:
- "localhost:5432:5432"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=rentapp
- POSTGRES_USER=postgres
where build is following:
FROM postgres:9.3
ADD dump.sql /docker-entrypoint-initdb.d/dump.sql
And it works fine on two machine ( one linux, one widnows).
But on 3rd machine it fails to start with following error:
db_1 | LOG: unrecognized configuration parameter "dynamic_shared_memory_type" in file "/var/lib/postgresql/data/postgresql.conf" line 130
db_1 | FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
docker-compose version 1.5.2, build 7240ff3
Docker version 1.9.1, build a34a1d5
That sounds like PostgreSQL is trying to re-use some existing volume too aggressively -- on the machine that's failing, can you try doing docker-compose rm -v db and then start it up again?
@tianon got the same error
db:
image: "postgres:9.3"
environment:
POSTGRES_PASSWORD: 1234
PGDATA: "/var/lib/postgresql/data/pgdata"
volumes:
- ./pgdata:/var/lib/postgresql/data/pgdata:rw
ports:
- "5432:5432"
console output:
igor@igor-N76VB:~/projects/local-docker/postgres$ docker-compose rm -v db
Going to remove postgres_db_1
Are you sure? [yN] y
Removing postgres_db_1...
igor@igor-N76VB:~/projects/local-docker/postgres$ docker-compose up
Creating postgres_db_1...
Attaching to postgres_db_1
db_1 | LOG: unrecognized configuration parameter "dynamic_shared_memory_type" in file "/var/lib/postgresql/data/pgdata/postgresql.conf" line 130
db_1 | FATAL: configuration file "/var/lib/postgresql/data/pgdata/postgresql.conf" contains errors
postgres_db_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
igor@igor-N76VB:~/projects/local-docker/postgres$
./pgdata:/var/lib/postgresql/data/pgdata:rw is storing the data locally -- you'll need to empty that directory as well (since that's where postgresql.conf is being generated/saved, and you've probably switched versions since it was first initialized) :+1:
Same error
version: '2'
services:
db:
build: .
environment:
PGDATA: /psql_data
volumes:
- /usr/local/var/postgres:/psql_data:rw
ports:
- "5432:5432"
output:
# docker-compose up
Creating network "psqldemo_default" with the default driver
Creating psqldemo_db_1 ...
Creating psqldemo_db_1 ... done
Attaching to psqldemo_db_1
db_1 | LOG: invalid value for parameter "lc_messages": "zh_CN.UTF-8"
db_1 | LOG: invalid value for parameter "lc_monetary": "zh_CN.UTF-8"
db_1 | LOG: invalid value for parameter "lc_numeric": "zh_CN.UTF-8"
db_1 | LOG: invalid value for parameter "lc_time": "zh_CN.UTF-8"
db_1 | FATAL: configuration file "/psql_data/postgresql.conf" contains errors
psqldemo_db_1 exited with code 1
@aldarund
@girokon
How did you fix this?
Comment the line dynamic_shared_memory_type in postgresql.conf -
It worked for me.