Update Dockerfiles to reference executable via ENTRYPOINT#815
Conversation
|
build shows errors like this |
|
Hey, sorry about that, I'm still looking into the cause. |
e6f3657 to
39a93ce
Compare
|
This is ready for review. I'll add a PR to the documentation repository as well |
cmd/query/Dockerfile
Outdated
| ADD jaeger-ui-build /go/jaeger-ui/ | ||
| CMD ["/go/bin/query-linux", "--query.static-files=/go/jaeger-ui/"] | ||
| ENTRYPOINT ["/go/bin/query-linux"] | ||
| CMD ["--query.static-files=/go/jaeger-ui/"] |
There was a problem hiding this comment.
The dockerfile docs state that ENTRYPOINT may be used with arguments, as such ENTRYPOINT ["top", "-b"].
I'm not clear on what advantage the combination for ENTRYPOINT to set the command and CMD to set defaults gives us. Could you elaborate?
There was a problem hiding this comment.
To answer my own question: It seems that we need to use the --entrypoint option to override the entry point while anything after the image in the docker command overrides cmd
There was a problem hiding this comment.
I was discussing with @yurishkuro about this, and agree with him in that moving "--query.static-files=/go/jaeger-ui" as an argument to the ENTRYPOINT command is better.
This is because overriding CMD in docker run overrides all the command parameters forcing users to pass in "--query.static-files=/go/jaeger-ui/".
By putting this in the ENTRYPOINT, other overrides become easier, and people may still override the static file location by using the -d option
There was a problem hiding this comment.
That sounds reasonable to me, however in the case that a user did override query.static-files, the resulting command would look like:
/go/bin/query-linux --query.static-files=/go/jaeger-ui/ --query.static-files=/my/desired/path
which seems a little weird at first glance, but it works because flags sets the last value it encounters. Are we ok relying on this?
Also, it seems like the same change would make sense for the defaults in cmd/standalone/Dockerfile.
I'm very new to the Jaeger repo, so thank you for the patience here!
|
lgtm, will merge when the documentation PR is up |
- In all Dockerfiles, reference the executable in ENTRYPOINT to allow consumers to override default parameters without needing to specify the executable path. - Common default arguments in the query and standalone Dockerfiles also move to ENTRYPOINT - Move hotrod default argument to CMD Signed-off-by: Zachary DiCesare <zachary.v.dicesare@gmail.com>
39a93ce to
864d66b
Compare
|
Updated this PR w/ feedback, but want to make sure we're ok with the new usage Documentation PR at jaegertracing/documentation#74 |
|
That's just how it would look internally, right? Don't think it matters as long as it works. Eventually we should fix #609 and not require this option to begin with. |
jpkrohling
left a comment
There was a problem hiding this comment.
Note that this is a breaking change and will affect everyone overriding the default flags.
This should also be coordinated with changes on:
https://github.com/jaegertracing/jaeger-kubernetes
https://github.com/jaegertracing/jaeger-openshift
https://github.com/kubernetes/charts/tree/master/incubator/jaeger
cmd/standalone/Dockerfile
Outdated
| COPY ./cmd/standalone/sampling_strategies.json /go/src/config/ | ||
|
|
||
| CMD ["/go/bin/standalone-linux","--query.static-files=/go/src/jaeger-ui-build/build/","--sampling.strategies-file=/go/src/config/sampling_strategies.json"] | ||
| ENTRYPOINT ["/go/bin/standalone-linux", "--query.static-files=/go/src/jaeger-ui-build/build/", "--sampling.strategies-file=/go/src/config/sampling_strategies.json"] |
There was a problem hiding this comment.
While I think the static files would "never" change for the Docker image (or would they?), the strategies file are most likely to change in some scenarios. As it's easier to override a config file than a flag on an entrypoint directive, it would be best to use a configuration file instead of passing values via flags, like:
COPY ./cmd/standalone/standalone.yaml /go/src/config/
ENTRYPOINT ["/go/bin/standalone-linux", "--config-file=/go/src/config/standalone.yaml"]./cmd/standalone/standalone.yaml doesn't exist yet, but could look like this:
query:
static-files: /go/jaeger-ui/
sampling:
strategies-file: /go/src/config/sampling_strategies.jsonThe other Dockerfiles should also follow the same pattern.
And finally, I would personally prefer /conf/ instead of /go/src/config/, and /bin/ instead of /go/bin/, unless there's a specific reason to keep go in the path name.
There was a problem hiding this comment.
I don't have a strong opinion on directories.
I have noticed that some images put binaries into /bin or /usr/share and configuration into /etc so in our case /etc/jaeger
There was a problem hiding this comment.
Those images are probably following the LSB (Linux Standard Base), which is a standard for this kind of thing on the Linux world. I'd be OK with that, if we do indeed place the config files at /etc/jaeger/standalone.yaml instead of /etc/jaeger.yaml.
There was a problem hiding this comment.
I meant /etc/jaeger as a dir for whatever configuration we need.
There was a problem hiding this comment.
But as I said I don't have a strong opinion. I am not sure what benefits putting binaries into /bin has as we use from scratch. One way or another following standard Linux conventions is not a bad thing :).
There was a problem hiding this comment.
If there are no options that need to be passed, then there's no reason to have a config file.
If there are CLI options to be passed (as is the case for the current state of this PR), then it's easier for a consumer to override a config file than override the entrypoint directive.
There was a problem hiding this comment.
I may be a step behind you here- but doesn't the consumer overriding a config file via an argument to the container require a volume mount? In that case it seems easier to override the entrypoint with additional command line arguments.
There was a problem hiding this comment.
The embedding of UI assets is done in #918. Once it's merged I suggest we change this one to
ENTRYPOINT ["/go/bin/standalone-linux"]
CMD ["--sampling.strategies-file=/go/src/config/sampling_strategies.json"]
I now see the value of using the config as the lowest priority default value, but I propose we leave it for another PR, as it won't be such a breaking change as this PR.
There was a problem hiding this comment.
Or rather:
ENTRYPOINT ["/go/bin/standalone-linux"]
CMD ["--sampling.strategies-file=/etc/jaeger/sampling_strategies.json"]There was a problem hiding this comment.
@jkandasa scenarios to test:
- Override the CMD with a custom option (
--log-level, for instance) - Override the
/etc/jaeger/sampling_strategies.jsonfile
|
Additional PRs at: Command line params to the jaeger containers in https://github.com/kubernetes/charts/tree/master/incubator/jaeger are all empty, and I did not see any references to the executables in that repo but definitely could use a confirmation on that. |
It would then need only a version bump, to make use of the new feature.
Also looks empty to me, but the best person to confirm would be @dvonthenen |
|
@jpkrohling @zdicesare Yup, command line params are empty. All configuration is done via ENV variables. A bump in the version should take care of it. |
cmd/query/Dockerfile
Outdated
| COPY query-linux /go/bin/ | ||
| ADD jaeger-ui-build /go/jaeger-ui/ | ||
| CMD ["/go/bin/query-linux", "--query.static-files=/go/jaeger-ui/"] | ||
| ENTRYPOINT ["/go/bin/query-linux", "--query.static-files=/go/jaeger-ui/"] |
There was a problem hiding this comment.
After #918, the --query.static-files option is optional and the assets are embedded into the binary, so, remove this from the entrypoint.
crossdock/docker-compose.yml
Outdated
| jaeger-query: | ||
| # override to disable static files | ||
| command: ["/go/bin/query-linux", "--query.static-files=", "--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"] | ||
| command: ["--query.static-files=", "--cassandra.keyspace=jaeger_v1_dc1", "--cassandra.servers=cassandra"] |
There was a problem hiding this comment.
The first option can be removed
Codecov Report
@@ Coverage Diff @@
## master #815 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 126 126
Lines 6070 6070
=====================================
Hits 6070 6070Continue to review full report at Codecov.
|
|
Thank you for updating this @yurishkuro, I can work on updating the other PRs with new images when this is out, including creating a version bump PR in https://github.com/kubernetes/charts/tree/master/incubator/jaeger |
In all Dockerfiles, reference the executable in ENTRYPOINT to allow
consumers to override default parameters without needing to specify
the executable path. Standard defaults move to ENTRYPOINT too for the same reason.
Signed-off-by: Zachary DiCesare zachary.v.dicesare@gmail.com
Which problem is this PR solving?
Short description of the changes
In all Dockerfiles, reference the executable path and standard default arguments in ENTRYPOINT
to allow consumers to override defaults without needing to specify them again.
Move hotrod default argument to CMD