Fail to start the elasticsearch container in ubuntu 16.04

(Bubunia Patra) #1

Hi all,

I am installing the elastic search in my MAC laptop running Ubuntu 16.04. ES version I am trying to install is 5.6.10.

Docker version 18.09.2, build 6247962

I have mounted my hostpath to container ES path for elasticsearch.yml.

docker run -d -p 9200:9200 -p 9300:9300 -v /Users/test/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml /Users/test/elasticsearch/bin

The container got created successfully and I could see the container in docker ps -a output. But it gives the below error and also i cannot start the ES container.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: "/Users/test/elasticsearch/bin": stat /Users/test/elasticsearch/bin: no such file or directory": unknown

Can anyone help me in this regard?


(xeraa) #2

Have you tried just running docker run -d -p 9200:9200 -p 9300:9300 -v /Users/test/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

I'm not sure what the /Users/test/elasticsearch/bin is supposed to do there?

PS: You'll want to bind mount /usr/share/elasticsearch/data from the container as well to avoid writing on the top layer of the image (both for performance and if you want to upgrade the base image).

(Bubunia Patra) #3

Thanks for your help. I am not able to exec to the ES container. I checked memory is 8GB for the AWS Ubuntu VM I have spinned off with 16.04. Could you please help?

docker run -d -p 9200:9200 -p 9300:9300 -v /home/ubuntu/es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

docker start 727dbecc2b468b9b4cda09607e452067246c435e0681d9eade02d3595dbc6761

apt-get install bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
bash is already the newest version (4.3-14ubuntu1.2).
0 upgraded, 0 newly installed, 0 to remove and 32 not upgraded.

free -m
total used free shared buff/cache available
Mem: 7982 133 7492 8 356 7590
Swap: 0 0 0

docker ps -a
727dbecc2b46 "/bin/bash bin/es-do…" 29 minutes ago Exited (1) 24 minutes ago musing_jackson

docker exec -it 727dbecc2b468b9b4cda09607e452067246c435e0681d9eade02d3595dbc6761 /bin/bash
Error response from daemon: Container 727dbecc2b468b9b4cda09607e452067246c435e0681d9eade02d3595dbc6761 is not running

docker exec -it 727dbecc2b468b9b4cda09607e452067246c435e0681d9eade02d3595dbc6761 bash

Error response from daemon: Container 727dbecc2b468b9b4cda09607e452067246c435e0681d9eade02d3595dbc6761 is not running

(xeraa) #4
  1. Please format your code blocks so they are easier to read.
  2. I'm not really sure what you are trying to do.
  • apt-get install bash? The base image is CentOS.
  • docker start? That's not required.

Let's take a step back and try with the minimal configuration. Run

docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ""

After a minute or so you should be able to connect to Elasticsearch with curl localhost:9200/. Does that work?

(Bubunia Patra) #5

No the curl http://localhost:9002 dont work and fails with connection refused error as ES service is down.

root# docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ""


root# curl
curl: (7) Failed to connect to localhost port 9002: Connection refused

Since I could not go inside the container using docker exec -it < container-id> bash I am stuck and could not proceed further need your help.

root # cat /etc/issue

Ubuntu 16.04.5 LTS \n \l

(xeraa) #6
  1. You are exposing port 9200. curl against 9002 will therefore not work.
  2. To get a shell in the container would be docker exec -it <container-id> /bin/bash, but this really shouldn't be necessary. There's nothing in there that you would need to start or install.

(Bubunia Patra) #7

Ohh my bad. Sorry for the typo about the port. Thanks for spotting that out :slight_smile:

The reason I need to go into the container is i have mounted the host path with the container port for elasticsearch.yml and want to check if the config chhanges written to the host mountpoint is getting reflected or not and to perform some actions/config changes inside the container related to ES.

any idea why i could not go to the container exec shell if the ES container is reachable? Could you please help.

(xeraa) #8

Just because something is written to a file doesn't mean Elasticsearch is actually applying it. Use the APIs of Elasticsearch to validate that your settings are working — for example the _cat APIs.

You keep your data on a bind mounted volume and just replace the container. It's really an anti-pattern having to connect into the container to change anything. Also a lot of runtime features can be changed through Elasticsearch's API.

It feels a bit like you are trying to use containers but want to configure them like a binary on the host. That way you'll get the disadvantages of both, but none of their advantages...

If you really want a shell in the container, docker exec -it <container-id> /bin/bash is working fine for me (though I'm on a Mac).

(Bubunia Patra) #9

I fixed the issue myself.

  1. The Ubuntu kernel that i was trying was having some compatibility issues with the ES version I was using.
  2. The path of elasticsearch.yml was inside the container for different ES version.

Thanks for your help.