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 initdb cannot be run as root, making it impossible to use postgres in a container #961

Closed
mcdonc opened this issue Jan 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@mcdonc
Copy link
Contributor

mcdonc commented Jan 28, 2024

With a devenv.nix that contains:

  services.postgres = {
    enable = true;
    package = pkgs.postgresql_16;
    initialDatabases = [ { name = "climo"; } { name = "assetdbmock"; } ];
    initdbArgs = [ "--locale=en_US.utf8" "--encoding=UTF8" ];
  };

Upon devenv container processes --docker-run:

"level":"warn","error":"user: lookup userid 0: no such file or directory","time":"2024-01-28T07:08:17Z","message":"Failed to retrieve user info."}
[postgres	] initdb: error: cannot be run as root
[postgres	] initdb: hint: Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.

This is a postgres "feature".

@mcdonc mcdonc added the bug Something isn't working label Jan 28, 2024
@mcdonc
Copy link
Contributor Author

mcdonc commented Jan 29, 2024

This will be fixed via #963

@mcdonc
Copy link
Contributor Author

mcdonc commented Feb 29, 2024

#963 was merged into the Python rewrite branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant