Reputation: 11
I have a problem with mounting a volume for Elasticsearch in docker-compose. The mount is for another disk, mounted at: /mt/sda/
I am using the following docker-compose.yml:
version: "3.0"
services:
elasticsearch:
container_name: elastic-container-rescue
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
volumes:
- es-data:/mt/sda/es-data
environment:
- xpack.security.enabled=true
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "network.host:0.0.0.0"
- ELASTIC_PASSWORD=$ES_PASS
ports:
- 9300:9200
networks:
- elastic
networks:
elastic:
driver: bridge
volumes:
es-data:
driver: local
When I check it with docker volume inspect
, it still shows incorrect mountpoint - it should be: /mt/sda/es-data
{
"CreatedAt": "2021-11-09T13:51:05+01:00",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "rescue-es",
"com.docker.compose.version": "1.25.5",
"com.docker.compose.volume": "es-data"
},
"Mountpoint": "/var/lib/docker/volumes/rescue-es_es-data/_data",
"Name": "rescue-es_es-data",
"Options": null,
"Scope": "local"
}
Any suggestions on how to assign the correct mountpoint?
Upvotes: 1
Views: 3260
Reputation: 7839
docker-compose.yml
version: "3.0"
services:
elasticsearch:
container_name: elastic-container-rescue
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
volumes:
- es-data:/usr/share/elasticsearch/data
environment:
- xpack.security.enabled=true
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "network.host:0.0.0.0"
- ELASTIC_PASSWORD=$ES_PASS
ports:
- 9300:9200
networks:
- elastic
networks:
elastic:
driver: bridge
volumes:
es-data:
driver: local
driver_opts:
o: bind
type: none
device: /mt/sda/es-data
Upvotes: 7