Skip to content

Make docker environment variable parsing available in CLI tools #45223

Closed
@tvernum

Description

@tvernum

Our docker entry point script has special logic to convert environment variables into -E options when starting Elasticsearch.

https://github.com/elastic/elasticsearch/blob/v7.3.0/distribution/docker/src/docker/bin/docker-entrypoint.sh#L41-L62

However this logic is not available when executing CLI commands via docker exec (or other similar commands like kubectl exec, etc) which surprises people, and makes it difficult to run some commands within a container.

e.g. https://discuss.elastic.co/t/how-to-use-elasticsearch-setup-passwords-with-tls-and-selfsigned-certificates/193795/7

I definitely don't think we should enable this environment parsing by default, but I wonder if there's value in having some sort of option for this.

A couple of ideas:

  1. Have a --docker (or --parse-env) option to our CLI tools (this could be handled in elasticsearch-cli or elasticsearch-env)
  2. Have a elasticsearch-parse-env script that generates -E options as output so that something like the below would work:
bin/elasticsearch-setup-passwords auto $(elasticsearch-parse-env)

I don't love any of this, but it's causing confusion right now so I think it's at least worth a discussion.

The CLI tools that I know of that make use of ES settings are (there may be others, I didn't dig too deeply):

  • elasticsearch-node (node roles)
  • elasticsearch-saml-metadata (realm settings)
  • elasticsearch-setup-passwords (HTTP URL, HTTP SSL settings)
  • elasticsearch-users (password hashing algorithm)

Metadata

Metadata

Assignees

Labels

:Core/Infra/CoreCore issues without another label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions