This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is better to do this fix in this file (which is the
CMD
) or in theDockerfile
. There are + and - for both approaches:As shown above, though the CMD (bin/es-docker) script
As this is always invoked when starting the container (unless the user overrides our
CMD
) there is a corner case that if a user ships his ownjvm.options
via a bind mount (or in the Dockerfile, while building his own docker image by forking ours) there could be a duplicate entry or generally the user get surprised where did that entry come from.On the other hand having the
echo
line inbin/es-docker
will always make sure that the parameter is present, but we could ensure it's done only if needed with a combo of grep + echo.Via the Dockerfile
If we just add the above echo command as a RUN line in the
Dockerfile
(after extracting the tarball) we ensure that things are correct in the image-shippedjvm.options
file and also no unexpected surprises if the user decides to bind mount jvm.options or create his own image.Downside of this approach is that it doesn't "enforce" the option for the user, in case he opts to use his own config file.
I'd like to hear your opinion on this. FWIW I am usually leaning in favor of solutions that don't try too hard to be clever and invasive so I think I'd favor doing it in the Dockerfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dliappis Given your thoughts here, which I agree with, I wonder what you think of:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this much more. Mutating that file could be really nasty, since it might be owned by the user and living on some persistent storage that they control.
If we can apply this fix via an environment variable, is there any reason not to do so with an
ENV
declaration in the Dockerfile? I think that's the most transparent and obvious place for future readers to understand what's happening.Wherever we do it, let's also have a comment linking back to this thread, since it's a pretty subtle thing that's going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong please, but I don't think we can do it in the Dockerfile since that bakes the value of ES_JAVA_OPTS into the image but users can override this externally when running the image.
I will push a comment explaining the situation later this morning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dliappis @Jarpy I pushed 490bcd6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that is correct and in the website docs docker-compose.yml example we are showing how to use
ES_JAVA_OPTS
as one method of defining the jvm heap size.@jasontedor Just so that I understand better this solution, basically
es.cgroups.hierarchy.override
can be defined as a jvm option, as documented here hence will be honored when presented throughES_JAVA_OPTS
?I am asking this as my understanding is that most parameters defined in
jvm.options
can also be passed as-E
style cli args. If that is true, the user can run the image usingdocker run ... -e es.cgroups.hierarchy.override=/
and so it could be the value here instead of the existinges_opts=''
?(Note that I tried the last point with 6.0.0-alpha1-SNAPSHOT and received:
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
This part is not right,
ES_JAVA_OPTS
andjvm.options
control JVM flags, so options inES_JAVA_OPTS
can also be set injvm.options
and vice-versa. The-E
CLI flags to Elasticsearch are Elasticsearch settings and can also be set inelasticsearch.yml
.This is expected since
es.cgroups.hierarchy.override
is not an Elasticsearch setting, we are reading it as JVM system property which is set via the JVM flag-Des.cgroups.hierarchy.override=/
; this can be done viajvm.options
orES_JAVA_OPTS
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @jasontedor !