Use spf13/cobra for docker run and docker create#23159
Use spf13/cobra for docker run and docker create#23159dnephin wants to merge 2 commits intomoby:masterfrom
docker run and docker create#23159Conversation
|
ping @duglin @LK4D4 @vdemeester PTAL |
|
Code looks good 👍 (and I like the |
|
Hm, looks like I found a really weird issue; This fails: So does this: But using "busybox" works; For alpine it sends an empty command; |
|
Hum some weirdies though (tried it out with @thaJeztah ) : Looks like the command is not passed ( |
|
Ok we (@vdemeester) found the difference; it appears to fail if there's no default command in the image. Doing this works: |
|
Some more testing, and this works ok |
4825a42 to
3a7de8c
Compare
|
Oops, sorry about that. I had a fix for that issue and I forgot to push it before opening the PR. That issue is now fixed. |
|
|
25db6b0 to
b93d092
Compare
There was a problem hiding this comment.
Is this something that should be in a generic spot so it can be reused by other commands?
There was a problem hiding this comment.
Doesn't seem to be used anywhere else. I just moved this, it already existed before my change.
There was a problem hiding this comment.
I think this is trying to mimic the error message that is normally raised when a flag or value is incorrect. These two commands do a bunch of validation on the flag values after the initial parsing, where as I think many commands don't do any additional validation.
02cbfad to
ef96863
Compare
docker rundocker run
docker rundocker run and docker create
|
The build is green! |
|
needs rebase |
ef96863 to
2096767
Compare
Move container options into a struct so that tests should pass. Remove unused FlagSet arg from Parse Disable interspersed args on docker run Signed-off-by: Daniel Nephin <[email protected]>
2096767 to
f0a8522
Compare
Return the correct status code on flag parsins errors. Signed-off-by: Daniel Nephin <[email protected]>
f0a8522 to
aaac5fd
Compare
|
ow; flaky/faulty test on WindowsTP5 (not related); guess this is the issue with Windows not liking filenames named |
|
Opened #23246 for the test |
|
Windows test will be fixed in #23248 |
|
it's green! |
|
LGTM |
|
Arf, needs a rebase 😓 |
|
Ah, probably because this one was merged #23241. I hoped this one would get merged first |
|
LGTM 👼 |
Carry #23159 : Use spf13/cobra for `docker run` and `docker create`
Carry moby#23159 : Use spf13/cobra for `docker run` and `docker create`
This PR builds off of #22769
As requested in #22769 (comment) this is a PoC to show that cobra and pflag will work for a more involved command like
docker run.