summaryrefslogtreecommitdiff
path: root/cmd/podman/images
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/images')
-rw-r--r--cmd/podman/images/load.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/images/load.go b/cmd/podman/images/load.go
index c7b7d6b3f..c39ae624e 100644
--- a/cmd/podman/images/load.go
+++ b/cmd/podman/images/load.go
@@ -9,6 +9,7 @@ import (
"strings"
"github.com/containers/common/pkg/completion"
+ "github.com/containers/common/pkg/download"
"github.com/containers/podman/v3/cmd/podman/registry"
"github.com/containers/podman/v3/cmd/podman/validate"
"github.com/containers/podman/v3/pkg/domain/entities"
@@ -69,6 +70,20 @@ func loadFlags(cmd *cobra.Command) {
func load(cmd *cobra.Command, args []string) error {
if len(loadOpts.Input) > 0 {
+ // Download the input file if needed.
+ if strings.HasPrefix(loadOpts.Input, "https://") || strings.HasPrefix(loadOpts.Input, "http://") {
+ tmpdir, err := util.DefaultContainerConfig().ImageCopyTmpDir()
+ if err != nil {
+ return err
+ }
+ tmpfile, err := download.FromURL(tmpdir, loadOpts.Input)
+ if err != nil {
+ return err
+ }
+ defer os.Remove(tmpfile)
+ loadOpts.Input = tmpfile
+ }
+
if _, err := os.Stat(loadOpts.Input); err != nil {
return err
}