-
Notifications
You must be signed in to change notification settings - Fork 917
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
ERROR: don't run elasticsearch as root #87
Comments
Elasticsearch is supposed to be started as a service, the corresponding init script starts it as the right user (namely |
Thank you. I added "--user elasticsearch" parameter in docker run command and that worked. Example below:
Is that a recommended way or updating elasticsearch a better option? Also, the above command only starts elasticsearch. I understand that it should start both kibana and elasticsearch unless I specify a parameter with value other than 1 explicitly. What could I be missing? Something that is not related to this thread, but would be very useful if you already know. If I want a cluster of nodes running on production environment, do I need kibana on all dockerized nodes (probably a stupid question, but still learning more about elasticsearch)? |
The image is designed to start the services using the
In a production cluster set-up it's best to keep Kibana separate from your ES master nodes, and depending on capacity requirements you may need several (e.g. load-balanced) Kibana nodes connected to your ES cluster. |
Thank you. I added the configuration parameters in the yml. Both the services are up and running, though I am not able to access elasticsearch on my browser via port 9200. localhost:5601 (kibana) works ok lsof -n -i:9200
Ideas? |
Could you confirm that you're observing this behaviour with the default image (i.e. non overriden with your config file)? I just want to rule out that this isn't a configuration error. Assuming that the answer is yes, then if the container starts properly (nothing suspicious in the logs, and nothing indicated at https://elk-docker.readthedocs.io/#troubleshooting), then the most common reason for what you're observing is that ES dies due to a lack of memory (see #57 for more on this, try running the container with at least 4GB RAM). (Oh by the way, the port being accessible from the host doesn't really mean anything, as it's Docker that's publishing it, even if there's nothing running at the other end.) |
I updated elasticsearch.yml with some parameters that I passed earlier via terminal. I believe if ES dies, kibana starts complaining via logs and I didn't see anything in kibana logs. I am checking logs to see if I can find something meaningful. |
I reverted back to default image and it seems to be working as expected. I am making incremental changes to see what exactly is the config error that is causing this problem since the logs are not indicating anything. Please let me know if you have any ideas in the meanwhile. UPDATE: I confirm that making any changes to elasticsearch.yml causes the issue to repro. Default config file just works fine. Let me know if you have any insight into this. UPDATE 2: I was able to figure out the issue. This happened because I changed the path of config files from /etc/elasticsearch to /etc/shared/elasticsearch. I wasn't aware of the default configs / paths that elasticsearch used, which I found it out here. |
OK thanks for the update, great to hear that you managed to figure out! |
I tried to run the container with additional elasticsearch parameters (tag = es240_l240_k460)
docker run --name elknode01 --net=es-network --restart always -p 9200:9200 -p 9300:9300 -p 5601:5601 myelkimage elasticsearch -Des.cluster.name=cluster-01 -Des.node.master=true -Des.node.name=node01
I get the following error:
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
I removed logstash from dockerfile since I don't need it and added the following to docker file:
ENV PATH /usr/share/elasticsearch/bin:$PATH
Replaced the following (+ means added, - means line removed):
Dockerfile:
start.sh
Somehow, docker is running elasticsearch as root when adding the parameters (-Des parameters mentioned above), while if I don't specify any additional parameters, it seems to work just fine. Tried googling quite a bit, but in vain.
I don't want to run as root, but I don't know how to run as another user. Are the scripts missing anything or am I missing something?
The text was updated successfully, but these errors were encountered: