Uh oh!
There was an error while loading. Please reload this page.
Allow arbitrary --user values (mostly) - #253
Conversation
One special case is that `initdb` _requires_ the current user to exist in `/etc/passwd`, but running PostgreSQL itself does not require that.
tianon
commented
Jan 19, 2017
$ docker run -it --rm --user 1000:1000 postgresinitdb: could not look up effective user ID 1000: user does not exist
$ docker run -it --rm --user www-data postgresThe files belonging to this database system will be owned by user "www-data".This user must also own the server process....
$ docker run -it --rm --user "$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd:ro postgresThe files belonging to this database system will be owned by user "tianon".This user must also own the server process....
$ dir="$(mktemp -d)"
$ docker run -it --rm -v "$dir":/var/lib/postgresql/data postgres... (let initialization finish, then stop the server)
$ sudo chown -R 1000:1000 "$dir"
$ docker run -it --rm -v "$dir":/var/lib/postgresql/data --user 1000:1000 postgresLOG: database system was shut down at 2017-01-19 23:06:31 UTCLOG: MultiXact member wraparound protections are now enabledLOG: database system is ready to accept connectionsLOG: autovacuum launcher started |
tianon
commented
Jan 19, 2017
The following comment from docker-library/mysql#161 (comment) also applies here:
|
yosifkit
commented
Jan 19, 2017
With regards to my comment of it breaking people that are taking advantage of being |
yosifkit
commented
Jan 19, 2017
We'll probably want to add some docs about the limitations observed here. |
tianon
commented
Jan 20, 2017
- `bash`: 4.4.7 - `golang`: 1.8rc2 - `haproxy`: add Lua support (docker-library/haproxy#38) - `postgres`: (mostly) arbitrary `--user` support (docker-library/postgres#253) - `python`: 3.4.6
srstsavage
commented
Feb 28, 2017
FWIW this did cause an issue for us, as a The How to extend this image section in the docs stll doesn't explicitly say that |
tianon
commented
Feb 28, 2017
Excellent idea, thanks @shane-axiom ❤️ I've filed a PR at docker-library/docs#848 👍 |
Travis CI & other builds were breaking due to docker-library/postgres#253
If permissions problems exist, they should be overcome properly. For examples see: LINK: docker-library/rabbitmq#60 LINK: docker-library/cassandra#48 LINK: docker-library/mongo#81 LINK: redis/docker-library-redis#48 LINK: docker-library/mysql#161 LINK: MariaDB/mariadb-docker#59 LINK: docker-library/percona#21 LINK: TryGhost/docker-library-ghost#54 LINK: docker-library/postgres#253 As suggested by @tianon LINK: docker-library/official-images#3724 (comment) This is part of an effort to make FluentD part of Docker's Official Images. Signed-off-by: Lee Jones <lee.jones@linaro.org>
If permissions problems exist, they should be overcome properly. For examples see: LINK: docker-library/rabbitmq#60 LINK: docker-library/cassandra#48 LINK: docker-library/mongo#81 LINK: redis/docker-library-redis#48 LINK: docker-library/mysql#161 LINK: MariaDB/mariadb-docker#59 LINK: docker-library/percona#21 LINK: TryGhost/docker-library-ghost#54 LINK: docker-library/postgres#253 As suggested by @tianon LINK: docker-library/official-images#3724 (comment) This is part of an effort to make FluentD part of Docker's Official Images. Signed-off-by: Lee Jones <lee.jones@linaro.org>
If permissions problems exist, they should be overcome properly. For examples see: LINK: docker-library/rabbitmq#60 LINK: docker-library/cassandra#48 LINK: docker-library/mongo#81 LINK: redis/docker-library-redis#48 LINK: docker-library/mysql#161 LINK: MariaDB/mariadb-docker#59 LINK: docker-library/percona#21 LINK: TryGhost/docker-library-ghost#54 LINK: docker-library/postgres#253 As suggested by @tianon LINK: docker-library/official-images#3724 (comment) This is part of an effort to make FluentD part of Docker's Official Images. Signed-off-by: Lee Jones <lee.jones@linaro.org>
If permissions problems exist, they should be overcome properly. For examples see: LINK: docker-library/rabbitmq#60 LINK: docker-library/cassandra#48 LINK: docker-library/mongo#81 LINK: redis/docker-library-redis#48 LINK: docker-library/mysql#161 LINK: MariaDB/mariadb-docker#59 LINK: docker-library/percona#21 LINK: TryGhost/docker-library-ghost#54 LINK: docker-library/postgres#253 As suggested by @tianon LINK: docker-library/official-images#3724 (comment) This is part of an effort to make FluentD part of Docker's Official Images. Signed-off-by: Lee Jones <lee.jones@linaro.org>
If permissions problems exist, they should be overcome properly. For examples see: LINK: docker-library/rabbitmq#60 LINK: docker-library/cassandra#48 LINK: docker-library/mongo#81 LINK: redis/docker-library-redis#48 LINK: docker-library/mysql#161 LINK: MariaDB/mariadb-docker#59 LINK: docker-library/percona#21 LINK: TryGhost/docker-library-ghost#54 LINK: docker-library/postgres#253 As suggested by @tianon LINK: docker-library/official-images#3724 (comment) This is part of an effort to make FluentD part of Docker's Official Images. Signed-off-by: Lee Jones <lee.jones@linaro.org>
This comment has been minimized.
This comment has been minimized.
tianon
commented
Mar 25, 2019
This PR isn't (and really can't) be the cause of PostgreSQL not working on Windows -- it doesn't change anything about how If you want to bypass our behavior entirely, it should be trivial to do so via |
This comment has been minimized.
This comment has been minimized.
yosifkit
commented
Mar 26, 2019
@willemavjc, try this comment: #558 (comment). tldr: it is not possible on Docker for Windows for Postgres to use a shared folder to the host |
willemavjc
commented
Mar 27, 2019
Thanks for sharing some links. Yes, that's the conclusion I ended up with. And yes, the only way with Docker for Windows to make "persistent" data is through a volume which is well documented on Docker documentation; in fact that was the first thing I tried when discovering docker/postgres. BUT... As a matter of fact, no one no longer can call this "persistent" data, "semi-persistent" data at the most if one really want to believe his data will last for ...some time. Because the Docker volume is on Windows limited to an inner directory within Moby, then the data will not survive any issue with Docker itself requiring a reset, for whatever the reason may be: unrecoverable crashes, environment refresh, etc. Said differently, the data is not onto the host fs, living on its own. Trying to fake the volume within Moby with a symlink made me realize the things which dysfunction: Moby writes on shared volumes as root, not a unprivileged user. When using Alpine of Postgres, one can write to Windows fs because I believe it passes all the way down root privileges. On the other hand, when logged as postgres, the story ends fast because it simply is not privileged; --privileged=true did nothing by the way. So the solution would either manage somehow postgres to write data as root or Docker to remap unprivilege writes operations as root for shared folders. Opened for any discussion on this point of view. |
One special case is that
initdbrequires the current user to exist in/etc/passwd, but running PostgreSQL itself does not require that.As discussed over in #93 (comment).
See also docker-library/rabbitmq#60, docker-library/cassandra#48, docker-library/mongo#81, redis/docker-library-redis#48, docker-library/mysql#161, MariaDB/mariadb-docker#59, docker-library/percona#21, and TryGhost/docker-library-ghost#54.
Closes#46
Closes#116
Closes#206
Closes#251
Ref #28