-
Notifications
You must be signed in to change notification settings - Fork 344
Make the privilege drop down optional #14
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
Conversation
As in some situation, it is impossible to execute `chown` on the data directory running elasticsearch as the `elasticsearch` user is not possible. The entry point now supports to run elasticsearch as `root` if the `RUN_AS_ROOT` environment variable is set to a non empty string. Fixes #5
How about having |
That would imply changing the |
Yes I thought of this but then I looked at the
|
A user might want to make the ability to tack on the group; |
Love this @yosifkit so the test would be to check if the user part is |
Seems it would also need to check if someone decided to put |
Yup. So working on it ... |
Not to complicate things, but |
I also just thought about the fact that there will be some inconsistency across the official images in the use of |
I am thinking this change can apply for all "data/server" images (ex: mysql, mongo, elasticsearch, redis, memcached...), so I would like to have it just as |
That's why |
👍 |
Quick wrench to throw in, would the |
Hmmm interesting ... current it would only apply to elasticsearch, not other commands. I can see your point however one goals of the entry point script was to run elasticsearch with the correct user and then give a bypass for everything else. Since the command would be executed directly you should probably resort to the normal docker mechanism and use |
That is what I was thinking, if they really need to be another user they are root and have |
The user and group can now be choosen using the `RUN_AS` environment variable. `RUN_AS` should follow the `user[:group]` pattern and both user/group numbers and user/group names are accepted. The `chown`/`gosu` mechanism is skipped when the user is either `0` or `root` or if the command is not `elasticsearch`.
And voilà |
LGTM |
Here's my thoughts on this:
|
I mostly agree with both items however for the first one I don't have any idea of a replacement name. |
Isn't the |
Without the chown, the user we switch to isn't able to write to the
directory.
|
It is not the problem, as it could (and should) be easily fixed by user. If he really need to chown. But the |
Ok, so what does the user chown to? The username inside the container may
not even exist on the host (and if it does, it's not very likely to match
UID/GID), so it's going to have to be an arbitrary UID/GID combination,
which is very much the opposite of user-friendly.
|
I can add some support to make the script work when the container is launched with a |
Guys, what is the right way to start elasticsearch:2 for now? With
Without
Guy in last comment https://hub.docker.com/_/elasticsearch/ has same problem |
bump Seems this thread was abandoned, but the issue is still real. |
After some discussion offline with @tianon, we are thinking that the best course of action is to gracefully skip operations that require root when the container is not run as root for all official images (as far as is possible). This will allow you to run with So, something like: if [ "$(id -u)" = '0' ]; then
chown ...
set -- gosu ...
fi
exec "$@" |
As in some situation, it is impossible to execute
chown
on thedata directory running elasticsearch as the
elasticsearch
user isnot possible. The entry point now supports to run elasticsearch
as
root
if theRUN_AS_ROOT
environment variable is set to a nonempty string.
Fixes #5