Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/podman/images/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func save(cmd *cobra.Command, args []string) (finalErr error) {
tags []string
succeeded = false
)
if strings.HasPrefix(args[0], "docker://") {
return fmt.Errorf("image %q is not in local storage; remove the docker:// prefix", args[0])
}
if cmd.Flag("compress").Changed && saveOpts.Format != define.V2s2ManifestDir {
return errors.New("--compress can only be set when --format is 'docker-dir'")
}
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/save_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ var _ = Describe("Podman save", func() {
Expect(save).To(ExitWithError(125, "repository name must be lowercase"))
})

It("podman save rejects docker transport", func() {
save := podmanTest.Podman([]string{"save", "-q", "docker://" + ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).To(ExitWithError(125, "is not in local storage; remove the docker:// prefix"))
})

It("podman save to directory with oci format", func() {
outdir := filepath.Join(podmanTest.TempDir, "save")

Expand Down