Lee Merlas
Lee Merlas

Reputation: 452

docker container does not work after restart

I have a VM and inside it, I am running an Elasticsearch Docker container built through docker-compose. It was working pretty well. Then after the power suddenly went out, I tried running the container back again but discovered an error that wasn't present before:

enter image description here

Then the container kept on restarting. And when I checked the file permissions (within the small window of time before the container restarts), I found this:

enter image description here

Here's my docker-compose.yml:

version: '2.3'
services:       
elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.8.0
    hostname: elasticsearch
    restart: always
    user: root
    ports:
        - "9200:9200"
        - "9300:9300"
    volumes:
       - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
    env_file:
        - devopsfw-elk.env

What is actually happening here? I'm fairly new to Docker and Elasticsearch and I'm very confused as to the errors that are occuring.

Upvotes: 0

Views: 1638

Answers (2)

Amit
Amit

Reputation: 32376

Looks like the file was owned by the root user and has been corrupted, in order to delete the file, you have to use the super user access aka sudo , so correct command would be

sudo  rm -i ./*elasticsearch.yml*

And after that, create a file and restart the conatainer.

Upvotes: 0

Alfro93
Alfro93

Reputation: 116

The problem is that the file has been corrupted, delete it and restart the container.

rm -i ./*elasticsearch.yml*

If you have problems to delete this, read this: https://superuser.com/questions/197605/delete-a-corrupt-file-in-linux

Upvotes: 2

Related Questions