Reputation: 3339
I'm following the instructions here https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
and only need one elastic search instance. When I run docker-compose up
I get an error saying The compose file docker-compose.yml is invalid because Unsupported config option for services.volumes: 'esdata1'
What am I doing wrong?
My docker-compose file
version: '2.1'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
Upvotes: 0
Views: 418
Reputation: 1006
You seem to have missed the top-level volumes
section towards the end of the sample file given here (https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-cluster-composefile).
Docker Compose v2 reference also specifies this requirement - https://docs.docker.com/compose/compose-file/compose-file-v2/#volumes-volumedriver
Excerpt from the above link:
For version 2 files, named volumes need to be specified with the top-level volumes key.
Upvotes: 1