Reputation: 131
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?
Upvotes: 4
Views: 893
Reputation: 264761
With Docker for Windows and Docker for Mac, you are running docker inside of a VM and mounting directories from inside that VM into your container. When the file or directory doesn't exist inside the VM, it will get mounted as an empty folder by Docker as a default behavior (this behavior appears to be changing with swarm mode).
To get a folder from the windows host into the VM where it can then be mapped into a container, you need to go into the docker settings and configure your shared drives:
https://docs.docker.com/docker-for-windows/#shared-drives
Upvotes: 3