Cannot start Elasticsearch 6.2.1 on Centos7

I've installed Elasticsearch 6.2.1 via RPM but when I try to run it gives me on several files.
This is my Dockerfile:
FROM centos:centos7

ADD elasticsearch.repo /etc/yum.repos.d/elasticsearch.repo
RUN rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch &&
yum install -y --setopt=tsflags=nodocs --nogpgcheck
java-1.8.0-openjdk-headless
elasticsearch-6.2.1

USER 1000
CMD ["sh", "/usr/share/elasticsearch/bin/elasticsearch"]

If I try to run build this image and run it will give me this err:
/usr/share/elasticsearch/bin/elasticsearch-env: line 70: /etc/sysconfig/elasticsearch: Permission denied

If I give permission for this file and try to run again. I will get other permission issues with var/lib/elasticsearch and var/log/elasticsearch.

I've also noticed that these file/directory are owned by elasticsearch group. I've tried to start elasticsearch as user 'elasticsearch' and it seems to work. However I wonder if there is any other way to run elasticsearch? Or is running as 'elasticsearch' user the standard way? Thanks.

Why not using elastic official docker image instead ?

I haven't tried it yet. But do you suggest any changes I should make with the current Dockerfile in order for the Elasticsearch to run ?

I don't know. I'm trying to always use the simplest path. :wink:

Do you happen to know where can I find the dockerfile that is used to build official image ?

nvm I found it

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.