Failed to connect optimize to elastic-search

I am trying to connect a standalone remote optimize to elastic search

Running

docker run --rm -it --name standalone-optimize -p 8090:8090 -p 8091:8091  \
	-e OPTIMIZE_CAMUNDABPM_REST_URL=http://localhost:8080/engine-rest \
	-e OPTIMIZE_ELASTICSEARCH_HOST=elasticsearch \
	-e OPTIMIZE_ELASTICSEARCH_HTTP_PORT=9200 \
	-e SPRING_PROFILES_ACTIVE=ccsm \
	-e CAMUNDA_OPTIMIZE_ZEEBE_ENABLED=true \
	-e CAMUNDA_OPTIMIZE_ENTERPRISE=false \
	-e CAMUNDA_OPTIMIZE_IDENTITY_ISSUER_URL=http://localhost:18080/auth/realms/camunda-platform \
	-e CAMUNDA_OPTIMIZE_IDENTITY_ISSUER_BACKEND_URL=http://keycloak:8080/auth/realms/camunda-platform \
	-e CAMUNDA_OPTIMIZE_IDENTITY_CLIENTID=optimize \
	-e CAMUNDA_OPTIMIZE_IDENTITY_CLIENTSECRET=XALaRPl5qwTEItdwCMiPS62nVpKs7dL7 \
	-e CAMUNDA_OPTIMIZE_IDENTITY_AUDIENCE=optimize-api \
	-e CAMUNDA_OPTIMIZE_SECURITY_AUTH_COOKIE_SAME_SITE_ENABLED=false \
	-e CAMUNDA_OPTIMIZE_UI_LOGOUT_HIDDEN=true \
	camunda/optimize:latest

Gives error

No Elasticsearch nodes available, waiting [5063] ms to retry connecting

Can’t connect to any Elasticsearch node [[host=http://elasticsearch:9200]].
Please check the connection!


Using camunda-platform docker cluster below

Hello @WarenaReveal ,

a docker container cannot refer to another docker container with localhost as long as he does not run in host network.

My suggestion would be to try to connect to elasticsearch:9200.

I hope this helps

Jonathan