docker-compose copies files as folder

Viewed 647

I am trying to copy elasticsearch.yml with CORS enabled from my host to a container using docker-compose volumes option. But when I copy the config folder it copies the elasticsearch.yml file in it as a folder.

Here is my docker-compose file:

version: "3"

services:  
elasticsearch1:  
    container_name: my_container_name
    image: elasticsearch
    environment:
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    volumes:
      - /config/:/usr/share/elasticsearch/config/
    ports:
      - '9200:9200'
      - '9300:9300'

And this is the error message i get whe running docker-compose up:

Exception in thread "main" SettingsException[Failed to load settings from /usr/share/elasticsearch/config/elasticsearch.yml]; nested: IOException[Is a directory];

I also tried copying to tmp folder, and file was listed as a folder:

drwxr-xr-x 2 root root 40 Jul 6 08:25 elasticsearch.yml

What am I doing wrong?

1 Answers
Related