From 7ada16829f5896f6c76bf537a193156285d4fc8c Mon Sep 17 00:00:00 2001 From: skyscooby <4450935+skyscooby@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:07:29 -0600 Subject: [PATCH 1/3] Update README.md Add the simplest solution to this issue as #1. --- postgres/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/postgres/README.md b/postgres/README.md index be5f3acf50a1..8aee8eed750f 100644 --- a/postgres/README.md +++ b/postgres/README.md @@ -335,11 +335,12 @@ $ docker run -it --rm --user 1000:1000 -e POSTGRES_PASSWORD=mysecretpassword pos initdb: could not look up effective user ID 1000: user does not exist ``` -The three easiest ways to get around this: +The four easiest ways to get around this: +1. use the matching UID:GID that the container installs for postgres user/group. This being 999:999 for Debian based containers and 70:70 for Alpine based containers. -1. allow the image to use [the `nss_wrapper` library](https://cwrap.org/nss_wrapper.html) to "fake" `/etc/passwd` contents for you (see [docker-library/postgres#448](https://github.com/docker-library/postgres/pull/448) for more details) +2. allow the image to use [the `nss_wrapper` library](https://cwrap.org/nss_wrapper.html) to "fake" `/etc/passwd` contents for you (see [docker-library/postgres#448](https://github.com/docker-library/postgres/pull/448) for more details) -2. bind-mount `/etc/passwd` read-only from the host (if the UID you desire is a valid user on your host): +3. bind-mount `/etc/passwd` read-only from the host (if the UID you desire is a valid user on your host): ```console $ docker run -it --rm --user "$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd:ro -e POSTGRES_PASSWORD=mysecretpassword postgres @@ -347,7 +348,7 @@ The three easiest ways to get around this: ... ``` -3. initialize the target directory separately from the final runtime (with a `chown` in between): +4. initialize the target directory separately from the final runtime (with a `chown` in between): ```console $ docker volume create pgdata From 3ccf2c70a13a41f66bb5c44384e081bbc1713de1 Mon Sep 17 00:00:00 2001 From: skyscooby <4450935+skyscooby@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:11:17 -0600 Subject: [PATCH 2/3] Update README.md Clarify on host machine, add blank line. --- postgres/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/postgres/README.md b/postgres/README.md index 8aee8eed750f..1b73f9be5bc3 100644 --- a/postgres/README.md +++ b/postgres/README.md @@ -336,7 +336,8 @@ initdb: could not look up effective user ID 1000: user does not exist ``` The four easiest ways to get around this: -1. use the matching UID:GID that the container installs for postgres user/group. This being 999:999 for Debian based containers and 70:70 for Alpine based containers. + +1. on host machine, use the matching UID:GID that the container installs for postgres user/group. This being 999:999 for Debian based containers and 70:70 for Alpine based containers. 2. allow the image to use [the `nss_wrapper` library](https://cwrap.org/nss_wrapper.html) to "fake" `/etc/passwd` contents for you (see [docker-library/postgres#448](https://github.com/docker-library/postgres/pull/448) for more details) From 14555a0be202a588e827048d19b8ed14b48854f9 Mon Sep 17 00:00:00 2001 From: skyscooby <4450935+skyscooby@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:13:53 -0600 Subject: [PATCH 3/3] Update README.md Cleanup English. --- postgres/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres/README.md b/postgres/README.md index 1b73f9be5bc3..995d62d47909 100644 --- a/postgres/README.md +++ b/postgres/README.md @@ -337,7 +337,7 @@ initdb: could not look up effective user ID 1000: user does not exist The four easiest ways to get around this: -1. on host machine, use the matching UID:GID that the container installs for postgres user/group. This being 999:999 for Debian based containers and 70:70 for Alpine based containers. +1. on the host, use the same UID:GID that the container defines for postgres user/group. These are 999:999 for Debian based containers and 70:70 for Alpine based containers. 2. allow the image to use [the `nss_wrapper` library](https://cwrap.org/nss_wrapper.html) to "fake" `/etc/passwd` contents for you (see [docker-library/postgres#448](https://github.com/docker-library/postgres/pull/448) for more details)