Postgres should work properly when its data files reside in a host directory mapped as a data volume.
I’m seeing repeatable warnings from postgres that various statistics files are corrupted like this:
postgres_1 | WARNING: corrupted statistics file "pg_stat_tmp/global.stat"
I was seeing this in my app setup and was able to put together a reproducible example.
OS X: version 10.11.5 (build: 15F28b)
Docker.app: version v1.11.0-beta9
Running diagnostic tests:
[OK] Moby booted
Docker logs are being collected into /tmp/20160503-091155.tar.gz
Most specific failure is: No error was detected
Your unique id is: 86DF8E94-5D0E-4814-8A71-11F007590D3D
Please quote this in all correspondence.
Steps to reproduce the behavior
- Create a dir with the above Dockerfile and docker-compose.yml
mkdir -p data/pgdata
- docker-compose build
- docker-compose up
Sorry about this next step. After doing this and running it, I was not seeing the errors. However, after I created a table in the database I created, I see them. I wasn’t able to figure out how to do this in the dockerfile so it needs to be done manually.
Since the docker containers are not run in the background, open up another terminal window:
- docker exec -it <name_of_the_postgres_container> bash
- psql --username=csroot --dbname=csdb
- Run the following command:
CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL
- You can exit psql via
Now it may take a while but if you wait, you should see the corrupted message.