-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cli/command/container/opts: make entrypoint json array avare #5839
base: master
Are you sure you want to change the base?
Conversation
…ax is correct entrypoint is already defined as strslice why not use its unmarshal method Signed-off-by: Lalyos Papp <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5839 +/- ##
==========================================
- Coverage 59.18% 58.78% -0.40%
==========================================
Files 352 349 -3
Lines 29548 29559 +11
==========================================
- Hits 17487 17376 -111
- Misses 11080 11199 +119
- Partials 981 984 +3 |
Signed-off-by: Lalyos Papp <[email protected]>
c01df63
to
305c048
Compare
Thanks for contributing; this may need more eyes; I recall some discussion long time ago where it was decided to always use shell-form for this. I generally agree that being able to use "exec" form could be useful, but if we make this change we must be sure it's not ambiguous; the slightly tricky bit here is that While we can try to detect if the given argument can be parsed as a valid JSON array (and fallback without), there can be some ambiguity, and we've ran into that case with the Dockerfile syntax (which also accepts either JSON (exec-form) or "shell" form, which sometimes causes hard to discover problems (e.g. |
I see, that is absolutely valid point. I was thinking about what could make this feature ambiguous: ruled out space and quotation mark but brackets are problematic. I could add more tests, but still it might be too risky of a change. I see 2 alternatives:
I don't think many people use cli plugins, so maybe just stick with the first option. |
I realise now that I had For docker create --entrypoint /bin/sh ubuntu -c "echo look ma entrypoint as an array"
d6741e207750af68f33c0cad6d23ea47d5ff46718c415f3f34d60fc0280cdfb1
docker inspect --format '{{json .Path}}' d6741e207750af68f33c0cad6d23ea47d5ff46718c415f3f34d60fc0280cdfb1
"/bin/sh"
docker inspect --format '{{json .Args}}' d6741e207750af68f33c0cad6d23ea47d5ff46718c415f3f34d60fc0280cdfb1
["-c","echo look ma entrypoint as an array"]
ISTR that there's limitations on Windows in that respect, because Windows does not have ways to have consistent parsing; there was a long discussion around some of that, and I must admit that I forgot the intricate details; opencontainers/runtime-spec#998 |
- What I did
Made the
docker run --entrypoint
handle entrypoint string the same way as:ENTRYPOINT
docker commit --change='ENTRYPOINT ["myEntryPoint.sh"]'
- How I did it
The enrtypoint option was already defined as strslice, so I just used its
UnmarshalJSON
method.- How to verify it
Test usecases are written for new format. Or for an e2e test you can check binaries, I built from this pr
- Human readable description for the release notes
closes #4870