mirror of
https://github.com/containers/podman.git
synced 2025-12-13 02:09:16 +08:00
support multi-image (docker) archives
Support loading and saving tarballs with more than one image. Add a new `/libpod/images/export` endpoint to the rest API to allow for exporting/saving multiple images into an archive. Note that a non-release version of containers/image is vendored. A release version must be vendored before cutting a new Podman release. We force the containers/image version via a replace in the go.mod file; this way go won't try to match the versions. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
22
vendor/github.com/containers/image/v5/docker/archive/src.go
generated
vendored
22
vendor/github.com/containers/image/v5/docker/archive/src.go
generated
vendored
@@ -3,9 +3,8 @@ package archive
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/containers/image/v5/docker/tarfile"
|
||||
"github.com/containers/image/v5/docker/internal/tarfile"
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type archiveImageSource struct {
|
||||
@@ -16,13 +15,20 @@ type archiveImageSource struct {
|
||||
// newImageSource returns a types.ImageSource for the specified image reference.
|
||||
// The caller must call .Close() on the returned ImageSource.
|
||||
func newImageSource(ctx context.Context, sys *types.SystemContext, ref archiveReference) (types.ImageSource, error) {
|
||||
if ref.destinationRef != nil {
|
||||
logrus.Warnf("docker-archive: references are not supported for sources (ignoring)")
|
||||
}
|
||||
src, err := tarfile.NewSourceFromFileWithContext(sys, ref.path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var archive *tarfile.Reader
|
||||
var closeArchive bool
|
||||
if ref.archiveReader != nil {
|
||||
archive = ref.archiveReader
|
||||
closeArchive = false
|
||||
} else {
|
||||
a, err := tarfile.NewReaderFromFile(sys, ref.path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
archive = a
|
||||
closeArchive = true
|
||||
}
|
||||
src := tarfile.NewSource(archive, closeArchive, ref.ref, ref.sourceIndex)
|
||||
return &archiveImageSource{
|
||||
Source: src,
|
||||
ref: ref,
|
||||
|
||||
Reference in New Issue
Block a user