-
Notifications
You must be signed in to change notification settings - Fork 202
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
Don't use Docker adjective if we don't have to #820
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,9 +27,9 @@ type SaveOptions struct { | |
} | ||
|
||
// Save saves one or more images indicated by `names` in the specified `format` | ||
// to `path`. Supported formats are oci-archive, docker-archive, oci-dir and | ||
// docker-dir. The latter two adhere to the dir transport in the corresponding | ||
// oci or docker v2s2 format. Please note that only docker-archive supports | ||
// to `path`. Supported formats are oci-archive, compat-archive, oci-dir and | ||
// dir. The latter two adhere to the dir transport in the corresponding | ||
// oci or docker v2s2 format. Please note that only compat-archive supports | ||
// saving more than one images. Other formats will yield an error attempting | ||
// to save more than one. | ||
func (r *Runtime) Save(ctx context.Context, names []string, format, path string, options *SaveOptions) error { | ||
|
@@ -46,8 +46,8 @@ func (r *Runtime) Save(ctx context.Context, names []string, format, path string, | |
case 1: | ||
// All formats support saving 1. | ||
default: | ||
if format != "docker-archive" { | ||
return errors.Errorf("unsupported format %q for saving multiple images (only docker-archive)", format) | ||
if format != "docker-archive" && format != "compat-archive" { | ||
return errors.Errorf("unsupported format %q for saving multiple images (only compat-archive)", format) | ||
} | ||
if len(options.AdditionalTags) > 0 { | ||
return errors.Errorf("cannot save multiple images with multiple tags") | ||
|
@@ -56,13 +56,13 @@ func (r *Runtime) Save(ctx context.Context, names []string, format, path string, | |
|
||
// Dispatch the save operations. | ||
switch format { | ||
case "oci-archive", "oci-dir", "docker-dir": | ||
case "oci-archive", "oci-dir", "docker-dir", "dir": | ||
if len(names) > 1 { | ||
return errors.Errorf("%q does not support saving multiple images (%v)", format, names) | ||
} | ||
return r.saveSingleImage(ctx, names[0], format, path, options) | ||
|
||
case "docker-archive": | ||
case "docker-archive", "compat-archive": | ||
options.ManifestMIMEType = manifest.DockerV2Schema2MediaType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Completely unrelated, I don’t see why this is hard-coded here. The transport already contains only that value in Is there some non-obvious reason for doing this? If so, it might be worth a comment.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably just old code. I can remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m really after the knowledge, not after dropping the line. It came in #551 and looks fairly unlikely to be accidental, but it’s not obvious to me why it was added. If we don’t know, let’s leave it it, at least in this PR. |
||
return r.saveDockerArchive(ctx, names, path, options) | ||
} | ||
|
@@ -72,7 +72,7 @@ func (r *Runtime) Save(ctx context.Context, names []string, format, path string, | |
} | ||
|
||
// saveSingleImage saves the specified image name to the specified path. | ||
// Supported formats are "oci-archive", "oci-dir" and "docker-dir". | ||
// Supported formats are "oci-archive", "oci-dir" and "docker-dir", "dir". | ||
func (r *Runtime) saveSingleImage(ctx context.Context, name, format, path string, options *SaveOptions) error { | ||
image, imageName, err := r.LookupImage(name, nil) | ||
if err != nil { | ||
|
@@ -105,7 +105,7 @@ func (r *Runtime) saveSingleImage(ctx context.Context, name, format, path string | |
destRef, err = ociTransport.NewReference(path, tag) | ||
options.ManifestMIMEType = ociv1.MediaTypeImageManifest | ||
|
||
case "docker-dir": | ||
case "docker-dir", "dir": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. |
||
destRef, err = dirTransport.NewReference(path) | ||
options.ManifestMIMEType = manifest.DockerV2Schema2MediaType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So actually there’s this hard-coded format setting, making And the history of that is containers/podman@d2ab53a , which has originally used Only fairly recently was Still — right now it is not a “Docker-defined directory”, but it is a “Docker-format-containing directory”. I’m not too happy about dropping the format name from the format. I’m tempted to complicate this further, leave There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docker save does not even support --format. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Podman does support |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
dir
? That is not supported bypodman save
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a WIP PR to support it. We refer to the "dir" transport in containers-transports, we should use the same terminology here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we then make
OCI
the default fordir
? Currently, it'sdocker
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a change in transports though? Would you want this to conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The c/image
dir:
transport is “raw unmodified accept-anything”, it’s not tied to a manifest format like Docker/OCI, and it’s specified by neither.I completely support not naming that destination
docker-dir
.Making ”OCI” (the manifest format?) default for
dir:
(the transport) would defeat the original “debugging destination” purpose in c/image; I suppose Podman could set up saves to use thedir:
format and force a conversion, but that seems worse in every way than just using theoci:
(oci/layout) transport and including an OCI-native index blob and the like.WRT whether
podman save
should default todir:
,oci:
(a directory), ordocker-archive:
/oci-archive:
, I don’t have a strong preference (I’d weakly say that thedir:
debugging format is probably not the right default) — anyway that seems like a topic for a different PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not interested in changing the default. Just in removing the "docker" adjective from our man pages when possible, especially when it adds little value. 10 instances of Docker in the podman save man page, none of which add any value to the user IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it’s just that, the man page lists the available options three times, when doing so just once in the
--format
section would probably suffice.The default value, and the conditionals for
--compress
and--multi-image-archive
, can’t be eliminated that easily, to be fair.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
containers/podman#12489