-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
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.
$ docker run -it --rm --user 1000:1000 postgres
initdb: could not look up effective user ID 1000: user does not exist
$ docker run -it --rm --user www-data postgres
The 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 postgres
The 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 postgres
LOG: database system was shut down at 2017-01-19 23:06:31 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started |
The following comment from docker-library/mysql#161 (comment) also applies here:
|
With regards to my comment of it breaking people that are taking advantage of being |
We'll probably want to add some docs about the limitations observed here. |
- `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
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 |
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: 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: 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: 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: 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: 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.
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.
@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 |
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
initdb
requires 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 docker-library/ghost#54.
Closes #46
Closes #116
Closes #206
Closes #251
Ref #28