mirror of
https://github.com/containers/podman.git
synced 2025-09-28 09:15:26 +08:00
podman load: support downloading files
Support downloading files, for instance via `podman load -i server.com/image.tar`. The specified URL is downloaded in the frontend and stored as a temp file that gets passed down to the backend. Also vendor in c/common@main to use the new `pkg/download`. Fixes: #11970 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
5
vendor/github.com/containers/common/libimage/import.go
generated
vendored
5
vendor/github.com/containers/common/libimage/import.go
generated
vendored
@ -2,9 +2,11 @@ package libimage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/containers/common/pkg/download"
|
||||
storageTransport "github.com/containers/image/v5/storage"
|
||||
tarballTransport "github.com/containers/image/v5/tarball"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
@ -61,7 +63,8 @@ func (r *Runtime) Import(ctx context.Context, path string, options *ImportOption
|
||||
u, err := url.ParseRequestURI(path)
|
||||
if err == nil && u.Scheme != "" {
|
||||
// If source is a URL, download the file.
|
||||
file, err := r.downloadFromURL(path)
|
||||
fmt.Printf("Downloading from %q\n", path)
|
||||
file, err := download.FromURL(r.systemContext.BigFilesTemporaryDir, path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
Reference in New Issue
Block a user