Not able to modify the /etc/hosts inside the ES container

Hi all,

I am using ES 5.6.10 and I want to add an entry to /etc/ hosts after the elasticsearch container is started and then restart the ES again. But I could not able to add any new entries to the /etc/hosts inside ES container

docker run -d -p 9200:9200 -p 9300:9300 -v /Users/test/Docker5610/elasticsearch.yml:/usr/share/elasticsearch/elasticsearch.yml <5.6 Image Docker location>

  1. After exec to the docker container i cannot edit the /etc/hosts. I checked couple of posts but its not working. I tried with ES 7.0.0 also and container is getting restarted multiple times. I tried with --privileged option also but it did not work.

  2. Where can I find the Docker files for the 5.6.10 ?

Can anybody help please as I am stuck now?

Regards
Pradeep

Any help?

Why do you want to do that?

I want to test a scenario (integration with a different tool) which requires the modification of /etc/hosts and restart elastic search service.

The different tool that you mentioned should run in its own container, no?
I mean that normally a container serves only one purpose if I'm not mistaken.

Yes. Basically let me elaborate what I am trying to do: I am trying to use open-source object storage to store ES snapshots. Currently I am having issues to resolve the DNS name when creating repo using bucket.[domain] in Elasticsearch container.ES is also deployed as container. So I am trying to test the scenario by adding the bucket lookup at /etc/hosts in ES to see that DNS resolve works or not. Can you pls help?

Currently I am having issues to resolve the DNS name when creating repo using bucket.[domain] in Elasticsearch container.

I think you should solve that but not by "hacking" elasticsearch. Instead may be implement a proper DNS resolution. I'm not an expert on that field though so I might be totally wrong but I'm finding counter-intuitive to try to fix it that way.

I'm afraid I can't.

Where can I find the Docker files for the 5.6.10 ?

Not sure for this version but here is what you can read for the master branch. Note that this is not the final version which is generated when you compile the project I think.
At least that could give you an idea.

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