Persist Postgres data in my host so data won’t be deleted every time I run a container.
db_1 | FATAL: data directory “/var/lib/postgresql/data/pgdata” has wrong ownership
db_1 | HINT: The server must be started by the user that owns the data directory.
Not sure if it will have any valuable info, but a diagnostic was uploaded with id: BD1854A3-041C-4C22-9FE5-1E5045910B45/2016-07-13_07-36-45
version: '2' services: web: build: context: . dockerfile: .docker/rails.dockerfile args: - http_proxy - https_proxy - no_proxy command: bash -c 'rm -f tmp/pids/server.pid && bundle install && bundle exec rails s -b "0.0.0.0"' volumes: - d:/test:/var/www ports: - "3000:3000" depends_on: - 'db' networks: - klipbox-network db: image: postgres networks: - test-network volumes: - d:/test/pgpersist:/var/lib/postgresql/data/pgdata ports: - "5432:5432" environment: PGDATA: /var/lib/postgresql/data/pgdata networks: test-network: driver: bridge
Don’t know if it makes any difference, but the d:\test directory is a Git repository, however pgpersist directory has been added to .gitignore
Steps to reproduce the behavior
- …Use the docker-compose file above
- …Run docker-compose up -d