Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres data directory has wrong ownership #2611

Closed
dendihandian opened this issue May 30, 2020 · 8 comments
Closed

Postgres data directory has wrong ownership #2611

dendihandian opened this issue May 30, 2020 · 8 comments

Comments

@dendihandian
Copy link

dendihandian commented May 30, 2020

Description:

Postgres container cannot be started and ended up with Exit 1 state

Expected Behavior:

Postgres container is running and can be accessed by client application.

Context information:

Output of git rev-parse HEAD

4f7ab34a6bbe45f0da8d0cd5d12ae62609a5f028

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:23:10 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker-compose version

docker-compose version 1.25.5, build 8a1c60f6
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c  28 May 2019

System info: Mac, Windows or Linux. Include which disto/version

Windows 10 Enterprise 10.0.18362 Build 18362

Steps to reproduce the issue:

  1. Run docker-compose up -d postgres
  2. Check the docker-compose ps
  3. Check the docker-compose logs postgres

Stacktrace & Additional info:

docker-compose ps result:

       Name                      Command              State                Ports
--------------------------------------------------------------------------------------------
laradock_postgres_1   docker-entrypoint.sh postgres   Exit 1

docker-compose logs postgres result:

Attaching to laradock_postgres_1
postgres_1             | The files belonging to this database system will be owned by user "postgres".
postgres_1             | This user must also own the server process.
postgres_1             |
postgres_1             | The database cluster will be initialized with locale "en_US.utf8".
postgres_1             | The default database encoding has accordingly been set to "UTF8".
postgres_1             | The default text search configuration will be set to "english".
postgres_1             |
postgres_1             | Data page checksums are disabled.
postgres_1             |
postgres_1             | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1             | initdb: could not create directory "/var/lib/postgresql/data/pg_xlog": File exists
postgres_1             | initdb: removing contents of data directory "/var/lib/postgresql/data"
postgres_1             | The files belonging to this database system will be owned by user "postgres".
postgres_1             | This user must also own the server process.
postgres_1             |
postgres_1             | The database cluster will be initialized with locale "en_US.utf8".
postgres_1             | The default database encoding has accordingly been set to "UTF8".
postgres_1             | The default text search configuration will be set to "english".
postgres_1             |
postgres_1             | Data page checksums are disabled.
postgres_1             |
postgres_1             | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1             | creating subdirectories ... ok
postgres_1             | selecting default max_connections ... 100
postgres_1             | selecting default shared_buffers ... 128MB
postgres_1             | selecting default timezone ... UTC
postgres_1             | selecting dynamic shared memory implementation ... posix
postgres_1             | creating configuration files ... ok
postgres_1             | running bootstrap script ... ok
postgres_1             | sh: locale: not found
postgres_1             | performing post-bootstrap initialization ... No usable system locales were found.
postgres_1             | Use the option "--debug" to see details.
postgres_1             | ok
postgres_1             | syncing data to disk ... ok
postgres_1             |
postgres_1             | Success. You can now start the database server using:
postgres_1             |
postgres_1             |     pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1             |
postgres_1             |
postgres_1             | WARNING: enabling "trust" authentication for local connections
postgres_1             | You can change this by editing pg_hba.conf or using the option -A, or
postgres_1             | --auth-local and --auth-host, the next time you run initdb.
postgres_1             | waiting for server to start....FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
postgres_1             | HINT:  The server must be started by the user that owns the data directory.
postgres_1             |  stopped waiting
postgres_1             | pg_ctl: could not start server
postgres_1             | Examine the log output.
@mokchend
Copy link

mokchend commented Jun 7, 2020

Issue occurs on Windows only (Seems to be a know issue on Windows, works fine on unix)
Solved using: docker-library/postgres#435
WORKAROUND: use named volume mount instead

@stale
Copy link

stale bot commented Sep 5, 2020

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Sep 5, 2020
@t0lik
Copy link

t0lik commented Sep 10, 2020

WORKAROUND: use named volume mount instead
This workaround is not quite comfortable to work with. It should be used ONLY as a temporary solution. I hope this issue will be solved

@stale stale bot removed the Stale label Sep 10, 2020
@jonathanlaf
Copy link

Any news here ? How can I modify my file to use named volume mount instead ?

@stale
Copy link

stale bot commented Jan 19, 2021

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Jan 19, 2021
@Stereotip42
Copy link

Any news here ?

@stale stale bot removed the Stale label Jan 21, 2021
@stale
Copy link

stale bot commented Apr 23, 2021

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Apr 23, 2021
@stale
Copy link

stale bot commented May 19, 2021

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants