Carry #23159 : Use spf13/cobra for docker run and docker create#23253
Carry #23159 : Use spf13/cobra for docker run and docker create#23253thaJeztah merged 2 commits intomoby:masterfrom
docker run and docker create#23253Conversation
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]>
Return the correct status code on flag parsins errors. Signed-off-by: Daniel Nephin <[email protected]>
|
Actually, looks like we're missing "see docker run --help" in the usage output; old: new Is that someone we need to fix here, or globally? |
|
Other than that, re-LGTM |
|
@thaJeztah good point. It's something to do globally 😝 |
|
ok LGTM, once we get a Windows CI node that isn't broken 😢 |
|
it's green! merging 👍 |
|
Looks like there are still some edge cases to consider: 😢 $ docker run --name test --rm debian:sid sh -c 'echo hi'
hi
$ docker create --name test debian:sid sh -c 'echo hi'
invalid argument "echo hi" for c: strconv.ParseInt: parsing "echo hi": invalid syntax
See 'docker create --help'. |
|
Darn, it's seeing |
|
Indeed, instead of stopping flag processing at the image name like |
|
From the looks of the diff, it appears |
|
Any command that expects extra flags after positional args needs to set That was done for |
|
Cool, sounds like an easy fix (phew). Thanks for finding, @tianon! We should have a test for that as well |
|
Seems to be an issue see #23329 |
Carry moby#23159 : Use spf13/cobra for `docker run` and `docker create`
Carry #23159 with conflict resolving.
Closes #23159.
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.