diff --git a/cmd/podman/diff/diff.go b/cmd/podman/diff/diff.go index 7fa47630a5..8fa9ca9880 100644 --- a/cmd/podman/diff/diff.go +++ b/cmd/podman/diff/diff.go @@ -73,6 +73,9 @@ func ValidateContainerDiffArgs(cmd *cobra.Command, args []string) error { return errors.New("--latest and containers cannot be used together") } if len(args) == 0 && !given { + if registry.IsRemote() { + return fmt.Errorf("%q requires a name or id", cmd.CommandPath()) + } return fmt.Errorf("%q requires a name, id, or the \"--latest\" flag", cmd.CommandPath()) } return nil diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index 6df5a85540..7507f35def 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -165,4 +165,13 @@ RUN touch %s`, ALPINE, imagefile) Expect(session.OutputToString()).To(ContainSubstring(confile)) }) + It("podman diff without args", func() { + session := podmanTest.Podman([]string{"diff"}) + session.WaitWithDefaultTimeout() + if IsRemote() { + Expect(session).Should(ExitWithError(125, " requires a name or id")) + } else { + Expect(session).Should(ExitWithError(125, " requires a name, id, or the \"--latest\" flag")) + } + }) })