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

Update postgres "arbitrary user" notes to reference new nss_wrapper functionality #1239

Merged
merged 1 commit into from
May 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions postgres/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@ $ docker run -it --rm --user 1000:1000 %%IMAGE%%
initdb: could not look up effective user ID 1000: user does not exist
```

The two easiest ways to get around this:
The three easiest ways to get around this:

1. bind-mount `/etc/passwd` read-only from the host (if the UID you desire is a valid user on your host):
1. use the Debian variants (not the Alpine variants) and thus 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):

```console
$ docker run -it --rm --user "$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd:ro %%IMAGE%%
The files belonging to this database system will be owned by user "jsmith".
...
```

2. initialize the target directory separately from the final runtime (with a `chown` in between):
3. initialize the target directory separately from the final runtime (with a `chown` in between):

```console
$ docker volume create pgdata
Expand Down