-
Notifications
You must be signed in to change notification settings - Fork 344
Run as user "elasticsearch" #5
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
Comments
Apart from having to adapt the permissions of |
It makes it more difficult to create derived Dockerfiles because the user
would need to know to add a “USER root" to do any commands that need root
before switching back to “USER elasticsearch".
|
Also, because you're relying on the creator of a derived Dockerfile to switch back to |
I am +1 on the gosu approach, unless it is not common to derive from this image. |
We still have the "having to adapt the permissions of
/usr/share/elasticsearch/data", so gosu sounds to me like our only
viable approach for now.
|
I was just looking at their run script and it would be nice if it respected a pre-existing setting of |
I might be one of the users who doesn't know very much about user rights in docker. But 2 days ago I spun up an ES 1.4.4 instance (using Vagrant on OSX), had no problems. Here was my config:
VagrantFile:
This set of configuration completely worked with the 1.4.4 image, mounts/volumes worked perfectly. I spun up the exact same setup for 1.5.0 (basically deleted what was in my /vagrant_data/es folder, and updated the dockerfile) Dockerfile:
Upon booting the new docker container, I get the following error if the initial volume is mounted NFS (which 1.4.4 was working as)
If I mount using virtualbox folders (default method, just to test), I don't see the OS level error, but I see the follow error when it starts ES
My next step is to create the image locally via your Dockerfile and see if that works any better, but before I do this, if anyone has any advice that would be great. Thanks |
@thomascooper, that looks like boot2docker/boot2docker#581. |
@yosifkit, you are correct for the standard mounted directories, but NFS Solves this issue (which is why 1.4.4 worked), something is different with 1.5.0 which stops the entrypoint script from running chown on the volume |
The previous image of 1.4.4 didn't have the chown and was running as root; the chown was only added in the last few days and was updated in official images with docker-library/official-images#619. |
So what would you suggest? For the typical issues with databases and apache/nginx are all solved by mounting with NFS, that solution still does not fix this problem. Should i just copy the dockerfile and remove the entrypoint line the rebuild? Should I try and find a solution to the permission? As it stands now, if you are running off windows or OSX, this image will not work without some manual configuration. |
The image will work fine under Windows or OS X if you leave the volume on the VM instead of trying to mount it from the host. I'm curious what the use case is for having the ES data live in a host directory. |
It should work the same way as the database images. Both chown the directory to the user and then step down from root, so I am not sure where the problem is. |
@md5 there are multiple use cases for leaving it on the host, in the case of boot2docker or vagrant, the underlying VM is supposed to be transparent. As I understand it (and I am newish to docker/vagrant) the VM in either case is just exposing docker to the host OS, I should be able to tear down and rebuild the host VM (which I do often) without losing my persistent data. |
Thanks @thomascooper. I also use boot2docker and very rarely rebuild the VM, so my persistent data just stays in the Virtualbox data disk. Since that file is backed up regularly to Time Machine along with the rest of my home directory, I don't worry too much about losing any data I might have in a Docker container. |
Anything else you guys can suggest for the issue with mounting a directory from the host OS then using the docker-entrypoint.sh? I tested pulling downing the Dockerfile and removing the entrypoint and as speculated it worked. |
Since you said you're using NFS, would it be possible to expose the mount with same UID and GID as the As @yosifkit said, the database images pretty much all follow the same pattern now used for ES. Have you been able to get |
The workaround would be as you noticed to bypass the entry point either by removing it in a derived image or from the command line. For the fix I think it is important to have elasticsearch run as a normal user instead of |
And yes, as @md5 said, I have the impression that stepping down from |
The
elasticsearch
package that is being installed for this image creates an "elasticsearch
" user that is used by theinit.d
script:This user is not being utilitized in the
/usr/share/elasticsearch/bin/elasticsearch
script, which means this image is currently running the ES service asroot
.The image should be updated so that the service does not run as
root
. Since ES doesn't appear to have its own way to drop privileges, it seems like that way to go here is withgosu
and a customENTRYPOINT
.The text was updated successfully, but these errors were encountered: