Created
January 22, 2025 18:23
-
-
Save radu-gheorghe/1e4ee5faebee6a5322bd645126ad49d8 to your computer and use it in GitHub Desktop.
docker-compose for Elasticsearch and Kibana without security
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION} | |
container_name: es01 | |
volumes: | |
- dev-elasticsearch:/usr/share/elasticsearch/data | |
ports: | |
- 127.0.0.1:9200:9200 | |
environment: | |
- discovery.type=single-node | |
- ELASTIC_PASSWORD=${ES_LOCAL_PASSWORD} | |
- xpack.security.enabled=false | |
- xpack.security.http.ssl.enabled=false | |
- ES_JAVA_OPTS=-Xms1g -Xmx1g | |
ulimits: | |
memlock: | |
soft: -1 | |
hard: -1 | |
healthcheck: | |
test: | |
[ | |
"CMD-SHELL", | |
"curl --output /dev/null --silent --head --fail -u elastic:${ES_LOCAL_PASSWORD} http://elasticsearch:9200", | |
] | |
interval: 5s | |
timeout: 5s | |
retries: 10 | |
kibana_settings: | |
depends_on: | |
elasticsearch: | |
condition: service_healthy | |
image: docker.elastic.co/elasticsearch/elasticsearch:${ES_VERSION} | |
container_name: kibana_settings | |
restart: 'no' | |
command: > | |
bash -c ' | |
echo "Setup the kibana_system password"; | |
until curl -s -u "elastic:${ES_LOCAL_PASSWORD}" -X POST http://elasticsearch:9200/_security/user/kibana_system/_password -d "{\"password\":\"'${KIBANA_LOCAL_PASSWORD}'\"}" -H "Content-Type: application/json" | grep -q "^{}"; do sleep 5; done; | |
' | |
kibana: | |
depends_on: | |
kibana_settings: | |
condition: service_completed_successfully | |
image: docker.elastic.co/kibana/kibana:${ES_VERSION} | |
container_name: kibana01 | |
volumes: | |
- dev-kibana:/usr/share/kibana/data | |
ports: | |
- 127.0.0.1:5601:5601 | |
environment: | |
- SERVER_NAME=kibana01 | |
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200 | |
- ELASTICSEARCH_USERNAME=kibana_system | |
- ELASTICSEARCH_PASSWORD=${KIBANA_LOCAL_PASSWORD} | |
# TODO: fill in your own random string | |
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=qwe12345678910111213141516171819202122233435 | |
- ELASTICSEARCH_PUBLICBASEURL=http://localhost:9200 | |
healthcheck: | |
test: | |
[ | |
"CMD-SHELL", | |
"curl -s -I http://kibana01:5601 | grep -q 'HTTP/1.1 302 Found'", | |
] | |
interval: 10s | |
timeout: 10s | |
retries: 20 | |
volumes: | |
dev-elasticsearch: | |
dev-kibana: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A
.env
file is also needed in the same directory, looking like: