elastic / elasticsearch-docker

Official Elasticsearch Docker image
Apache License 2.0
791 stars 240 forks source link

Adding jq to base image #211

Closed xrl closed 5 years ago

xrl commented 5 years ago

Feature Description

I am doing some custom bootstrapping code using elasticsearch:6.4.1 and I end up adding the jq package every time. Could we put that in the standard distribution? It'll be useful for anyone who uses curl and wants to extract specific values.

The jq package has 1 dependency, oniguruma. That's it.

jasontedor commented 5 years ago

Thanks for your interest. I agree with you that jq is useful, especially in the context of working with Elasticsearch. I use it almost daily. However, I would be reluctant to add this to the distribution. While jq is small, we have a goal within our other constraints to keep the image as small possible. It would be hard to add this tool and say no to other tools, and then we end up boosting the image size more the necessary. I know today our image is not small by any stretch (again, we have other constraints) but we do want to keep it as small as we can, and maybe another day we can tackle making it even smaller.

My perspective, and maybe it’s off so please feel free to disagree, is that it would be best to not be execing curl | jq inside the container anyway. Instead, you would want to do that out of the container. There are lightweight images that contain curl and jq, so I don’t feel it’s a limitation to suggest using those?

I am curious to hear other perspectives as well.

drewr commented 5 years ago

I agree with @jasontedor. Leave the base image with the essentials necessary for only running Elasticsearch. You can curl | jq in whatever environment you're testing from.

If you really do need to do it from the container, this is where Docker shines anyway. Make your own container:

FROM docker.elastic.co/elasticsearch/elasticsearch:6.4.2
RUN yum install --y jq
[...]
xrl commented 5 years ago

I am trying to keep the Elasticsearch containers are "untouched" as possible so I'm always able to grab images directly from the docker.elastic.co repo.

I have set up a script which can generate CSRs using the elasticsearch-certutil script (which uses unzip, yum installed in the Elasticsearch Dockerfile), uses curl and jq to talk to our cert signing services, and configured everything so x-pack is ready to go on boot.

I may consider vendoring jq/oniguruma RPMs to S3 and downloading them directly without doing traffic/time heavy yum operations.

xrl commented 5 years ago

I am OK with the reasoning behind keeping JQ out of the base image. The line does have to be drawn at some point. zip OK, jq, not OK! 😄