Hi team, trying to create a custom elasticsearch docker image base image is set as 8.15.0, following is my Dockerfile which is getting built-:
# Use the official Elasticsearch 8.15 base image
FROM docker.elastic.co/elasticsearch/elasticsearch:8.15.0
# Set environment variables (you can customize these)
# Ensure the directory for data persistence is set correctly
ENV discovery.type=single-node
ENV ELASTIC_PASSWORD=elastic123
ENV xpack.security.enabled=true
ENV xpack.security.http.ssl.enabled=false
ENV xpack.security.transport.ssl.enabled=false
ENV xpack.license.self_generated.type=trial
ENV ES_PORT=9200
# Create a mount point for the data volume to persist indices
VOLUME ["/usr/share/elasticsearch/data"]
# Expose Elasticsearch port
EXPOSE 9200
# Run Elasticsearch
CMD ["/bin/bash", "-c", "/usr/share/elasticsearch/bin/elasticsearch"]
image is built successfully and the expectancy is that when this image runs it should allow me a basic auth with the username as -: elastic and password as we can see provided above in ENV as elastic123 but that does not happen? it gives me a following response when trying to hit the cluster health api-:
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "unable to authenticate user [elastic] for REST request [/_cluster/health]",
"header": {
"WWW-Authenticate": [
"Basic realm=\"security\", charset=\"UTF-8\"",
"ApiKey"
]
}
}
],
"type": "security_exception",
"reason": "unable to authenticate user [elastic] for REST request [/_cluster/health]",
"header": {
"WWW-Authenticate": [
"Basic realm=\"security\", charset=\"UTF-8\"",
"ApiKey"
]
}
},
"status": 401
}
I only need basic-auth no requirement of any kind of ssl.
Please need urgent support, where i am going wrong in my configurations? Thanks in advance.