3
votes

When I typed "docker-compose up", I got this error: Starting elasticsearch-1 ... error

ERROR: for elasticsearch-1 Cannot start service elasticsearch-1: b'OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Users/user/Desktop/data/elasticsearch.yml\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/aufs/mnt/3ec70a7ad26a47f6537aed2ac091eb2507dfb4de983183b0e669832229f948d7\\\" at \\\"/mnt/sda1/var/lib/docker/aufs/mnt/3ec70a7ad26a47f6537aed2ac091eb2507dfb4de983183b0e669832229f948d7/usr/share/elasticsearch/config/elasticsearch.yml\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type'

Docker-compose.yml contains the following:

From: http://blog.sandeepchivukula.com

elasticsearch-1:
     image: elasticsearch
     container_name: elasticsearch-1
     ports:
        - "9200:9200"
        - "9300:9300"
     volumes:
        - ./data/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
     command: elasticsearch

kibana-frontend:
     image: kibana:latest
     container_name: kibana-frontend
     ports:
        - "5601:5601"
     links:
       - elasticsearch-1:elasticsearch

Could you please help me solve this error? Any help will be appreciated Thank you in advance

3

3 Answers

1
votes

I had the same problem today, and I found the solution for my case in this GitHub Thread:

Cause: I had to change my Windows password today
Solution: The error stopped after going into Docker settings -> Shared Drives, un-selecting my drive (+ Apply), restarting Docker app and then re-selecting (+ Apply).

Kudos to danielcgithub!

0
votes

Clone (or download the ZIP) of the whole project from GIT and start the docker inside the project folder:

#git clone https://github.com/sandeep/photosearch/?utm_source=sandeepchivukula.com&utm_medium=blog&utm_campaign=photosearch
#cd photosearch
#docker compose up
0
votes

You can not bind a volume on a single file.

Either you bind the entire directory:

elasticsearch-1:
     image: elasticsearch
     container_name: elasticsearch-1
     ports:
        - "9200:9200"
        - "9300:9300"
     volumes:
        - ./data/:/usr/share/elasticsearch/config/
     command: elasticsearch

Or you can use docker configs (see further documentation here):

elasticsearch-1:
     image: elasticsearch
     container_name: elasticsearch-1
     ports:
        - "9200:9200"
        - "9300:9300"
     configs:
        - source: elasticsearch_config
          target: /usr/share/elasticsearch/config/elasticsearch.yml
     command: elasticsearch

configs:
     elasticsearch_config:
         file: ./data/elasticsearch.yml