Skip to content

Cannot set the elasticsearch bootstrap password in docker using environment variable. #37240

Closed
@francistb

Description

@francistb

Elasticsearch version (bin/elasticsearch --version):
7.0.0-alpha2

Description of the problem including expected versus actual behavior:
Setting the ELASTIC_PASSWORD environment variable should allow to configure the elasticsearch bootstrap password in docker :
https://www.elastic.co/guide/en/elasticsearch/reference/master/configuring-tls-docker.html#CO19-2

Steps to reproduce:
docker run --rm -p 9200:9200 -e 'xpack.security.enabled=true' -e 'discovery.type=single-node' -e 'xpack.license.self_generated.type=trial' -e 'ELASTIC_PASSWORD=changeme' docker.elastic.co/elasticsearch/elasticsearch:7.0.0-alpha2

curl http://localhost:9200 -u elastic:changeme

Expected :
200 OK response

Actual :
401 Unauthorized

[2019-01-08T22:15:17,981][INFO ][o.e.x.s.a.AuthenticationService] [afb4f96ae58a] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]

Problem seems to be with the docker-entrypoint.sh on this line https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/bin/docker-entrypoint.sh#L78 where it validates that the x-pack directory exists under bin, but it does not. Changing it for something like if [[ -f bin/x-pack-env ]]; then seems to fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Delivery/PackagingRPM and deb packaging, tar and zip archives, shell and batch scriptsPioneer ProgramTeam:DeliveryMeta label for Delivery team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions