Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-entrypoint.sh uses a mix of absolute and relative/implied paths #98643

Closed
DaveCTurner opened this issue Aug 19, 2023 · 3 comments
Closed
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team

Comments

@DaveCTurner
Copy link
Contributor

We invoke elasticsearch via its absolute path here:

exec /usr/share/elasticsearch/bin/elasticsearch "$@" $POSITIONAL_PARAMETERS <<<"$KEYSTORE_PASSWORD"

However we also invoke elasticsearch-keystore in several places, and none of them specify its path so we are relying on picking up the right binary from $PATH. For instance:

[[ -f /usr/share/elasticsearch/config/elasticsearch.keystore ]] || (elasticsearch-keystore create)

We also check for the existence of bin/elasticsearch-users relative to the current directory:

if [[ -f bin/elasticsearch-users ]]; then

Should these all be absolute paths to avoid any ambiguity if running in a slightly weird environment? I ask because a user on the forums needed to make some adjustments to how we start up within their Docker environment, and these non-absolute paths got in their way a bit.

@DaveCTurner DaveCTurner added >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels Aug 19, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@elasticsearchmachine elasticsearchmachine added the Team:Delivery Meta label for Delivery team label Aug 19, 2023
@mark-vieira
Copy link
Contributor

Should these all be absolute paths to avoid any ambiguity if running in a slightly weird environment?

I think there are some implicit expectations here that the working directory of many scripts is $ES_HOME. See here.

That said, that's after the docker-entrypoint.sh script is run so we could probably make it agnostic to working directory.

Do you have any details on this specific use-case?

@mark-vieira
Copy link
Contributor

@DaveCTurner I'm not sure we're planning on making any changes here. I went back and looked at the original forums post and I think the best solution for that use case would be to use a customized docker image rather than trying to override the image entrypoint. I don't think there's a compelling reason or use-case for using absolute paths in this script when we explicitly add the bin directory to PATH. Both for convenience, and so folks can do things like docker run elasticsearch:latest elasticsearch-keystore w/o having to specify an absolute path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team
Projects
None yet
Development

No branches or pull requests

3 participants