services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION:-8.12.2} container_name: elasticsearch restart: always ports: - '9200:9200' - '9300:9300' networks: - nice-net environment: - discovery.type=single-node - xpack.security.enabled=true - ELASTIC_PASSWORD=${ELASTIC_PASSWORD:-nice_elastic_password} - 'ES_JAVA_OPTS=-Xms512m -Xmx512m' volumes: - type: volume source: elasticsearch_data target: /usr/share/elasticsearch/data healthcheck: test: curl -s http://localhost:9200/_cluster/health | grep -v '"status":"red"' interval: 10s timeout: 5s retries: 3 volumes: elasticsearch_data: driver: local driver_opts: type: none device: ${PWD}/volumes/elasticsearch o: bind