aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-18 10:49:34 -0700
committerGitHub <noreply@github.com>2019-03-18 10:49:34 -0700
commit9289ecd478176bc3de29792d500b1383683bfe79 (patch)
tree6a4161f8911140921776d86c64a9cb74b4918ab2
parent91b00281e8b785208e1330a5c9679aa63a907eb9 (diff)
parentd0ee203986b2de559d4b6240bab7dda789bafb73 (diff)
downloadpodman-9289ecd478176bc3de29792d500b1383683bfe79.tar.gz
podman-9289ecd478176bc3de29792d500b1383683bfe79.tar.bz2
podman-9289ecd478176bc3de29792d500b1383683bfe79.zip
Merge pull request #2674 from rhatdan/load
Cleanup messages on podman load
-rw-r--r--README.md2
-rw-r--r--cmd/podman/load.go71
-rw-r--r--commands.md2
-rw-r--r--docs/podman-load.1.md18
-rw-r--r--docs/podman-save.1.md5
-rw-r--r--install.md1
6 files changed, 48 insertions, 51 deletions
diff --git a/README.md b/README.md
index 636a6fa5b..fe78c9d58 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ popularized by Kubernetes. Libpod also contains the Pod Manager tool `(Podman)`
At a high level, the scope of libpod and podman is the following:
-* Support multiple image formats including the existing Docker/OCI image formats.
+* Support multiple image formats including the OCI and Docker image formats.
* Support for multiple means to download images including trust & image verification.
* Container image management (managing image layers, overlay filesystems, etc).
* Full management of container lifecycle
diff --git a/cmd/podman/load.go b/cmd/podman/load.go
index 46add699e..04ff9fcca 100644
--- a/cmd/podman/load.go
+++ b/cmd/podman/load.go
@@ -5,21 +5,24 @@ import (
"io"
"io/ioutil"
"os"
+ "strings"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared/parse"
"github.com/containers/libpod/pkg/adapter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+ "golang.org/x/crypto/ssh/terminal"
)
var (
loadCommand cliconfig.LoadValues
- loadDescription = "Loads the image from docker-archive stored on the local machine."
- _loadCommand = &cobra.Command{
- Use: "load [flags] [PATH]",
- Short: "Load an image from docker archive",
+ loadDescription = "Loads an image from a locally stored archive (tar file) into container storage."
+
+ _loadCommand = &cobra.Command{
+ Use: "load [flags] [NAME[:TAG]]",
+ Short: "Load an image from container archive",
Long: loadDescription,
RunE: func(cmd *cobra.Command, args []string) error {
loadCommand.InputArgs = args
@@ -60,49 +63,43 @@ func loadCmd(c *cliconfig.LoadValues) error {
}
defer runtime.Shutdown(false)
- input := c.Input
- if runtime.Remote && len(input) == 0 {
- return errors.New("the remote client requires you to load via -i and a tarball")
- }
- if len(input) == 0 {
- input = "/dev/stdin"
- c.Input = input
-
- fi, err := os.Stdin.Stat()
- if err != nil {
+ if len(c.Input) > 0 {
+ if err := parse.ValidateFileName(c.Input); err != nil {
return err
}
- // checking if loading from pipe
- if !fi.Mode().IsRegular() {
- outFile, err := ioutil.TempFile("/var/tmp", "podman")
- if err != nil {
- return errors.Errorf("error creating file %v", err)
- }
- defer os.Remove(outFile.Name())
- defer outFile.Close()
-
- inFile, err := os.OpenFile(input, 0, 0666)
- if err != nil {
- return errors.Errorf("error reading file %v", err)
- }
- defer inFile.Close()
-
- _, err = io.Copy(outFile, inFile)
- if err != nil {
- return errors.Errorf("error copying file %v", err)
- }
+ } else {
+ if terminal.IsTerminal(int(os.Stdin.Fd())) {
+ return errors.Errorf("cannot read from terminal. Use command-line redirection or the --input flag.")
+ }
+ outFile, err := ioutil.TempFile("/var/tmp", "podman")
+ if err != nil {
+ return errors.Errorf("error creating file %v", err)
+ }
+ defer os.Remove(outFile.Name())
+ defer outFile.Close()
- input = outFile.Name()
+ _, err = io.Copy(outFile, os.Stdin)
+ if err != nil {
+ return errors.Errorf("error copying file %v", err)
}
- }
- if err := parse.ValidateFileName(input); err != nil {
- return err
+
+ c.Input = outFile.Name()
}
names, err := runtime.LoadImage(getContext(), imageName, c)
if err != nil {
return err
}
+ if len(imageName) > 0 {
+ split := strings.Split(names, ",")
+ newImage, err := runtime.NewImageFromLocal(split[0])
+ if err != nil {
+ return err
+ }
+ if err := newImage.TagImage(imageName); err != nil {
+ return errors.Wrapf(err, "error adding '%s' to image %q", imageName, newImage.InputName)
+ }
+ }
fmt.Println("Loaded image(s): " + names)
return nil
}
diff --git a/commands.md b/commands.md
index 6c5fad2f6..31a77c0c4 100644
--- a/commands.md
+++ b/commands.md
@@ -34,7 +34,7 @@
| [podman-info(1)](/docs/podman-info.1.md) | Display system information |[![...](/docs/play.png)](https://asciinema.org/a/yKbi5fQ89y5TJ8e1RfJd4ivTD)|
| [podman-inspect(1)](/docs/podman-inspect.1.md) | Display the configuration of a container or image |[![...](/docs/play.png)](https://asciinema.org/a/133418)|
| [podman-kill(1)](/docs/podman-kill.1.md) | Kill the main process in one or more running containers |[![...](/docs/play.png)](https://asciinema.org/a/3jNos0A5yzO4hChu7ddKkUPw7)|
-| [podman-load(1)](/docs/podman-load.1.md) | Load an image from docker archive or oci |[![...](/docs/play.png)](https://asciinema.org/a/kp8kOaexEhEa20P1KLZ3L5X4g)|
+| [podman-load(1)](/docs/podman-load.1.md) | Load an image from a container image archive |[![...](/docs/play.png)](https://asciinema.org/a/kp8kOaexEhEa20P1KLZ3L5X4g)|
| [podman-login(1)](/docs/podman-login.1.md) | Login to a container registry |[![...](/docs/play.png)](https://asciinema.org/a/oNiPgmfo1FjV2YdesiLpvihtV)|
| [podman-logout(1)](/docs/podman-logout.1.md) | Logout of a container registry |[![...](/docs/play.png)](https://asciinema.org/a/oNiPgmfo1FjV2YdesiLpvihtV)|
| [podman-logs(1)](/docs/podman-logs.1.md) | Display the logs of a container |[![...](/docs/play.png)](https://asciinema.org/a/MZPTWD5CVs3dMREkBxQBY9C5z)|
diff --git a/docs/podman-load.1.md b/docs/podman-load.1.md
index 5363f3f1e..8a1660c63 100644
--- a/docs/podman-load.1.md
+++ b/docs/podman-load.1.md
@@ -1,22 +1,24 @@
% podman-load(1)
## NAME
-podman\-load - Load an image from docker archive
+podman\-load - Load an image from a container image archive into container storage
## SYNOPSIS
-**podman load** [ARCHIVE]
+**podman load** [*name*[:*tag*]]
## DESCRIPTION
-**podman load** copies an image from either **docker-archive** or **oci-archive** stored
-on the local machine. **podman load** reads from stdin by default or a file if the **input** flag is set.
-The **quiet** flag suppresses the output when set.
+**podman load** loads an image from either an **oci-archive** or **docker-archive** stored on the local machine into container storage. **podman load** reads from stdin by default or a file if the **input** option is set.
+You can also specify a name for the image if the archive does not contain a named reference, of if you want an additonal name for the local image.
+
+The **quiet** option suppresses the progress output when set.
Note: `:` is a restricted character and cannot be part of the file name.
+
**podman [GLOBAL OPTIONS]**
**podman load [GLOBAL OPTIONS]**
-**podman load [OPTIONS] NAME[:TAG|@DIGEST]**
+**podman load [OPTIONS] NAME[:TAG]**
## OPTIONS
@@ -28,7 +30,7 @@ The remote client requires the use of this option.
**--quiet, -q**
-Suppress the output
+Suppress the progress output
**--signature-policy="PATHNAME"**
@@ -75,7 +77,7 @@ Loaded image: registry.fedoraproject.org/fedora:latest
```
## SEE ALSO
-podman(1), podman-save(1), crio(8)
+podman(1), podman-save(1), podman-tag(1), crio(8)
## HISTORY
July 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>
diff --git a/docs/podman-save.1.md b/docs/podman-save.1.md
index a0b04d633..75aeda797 100644
--- a/docs/podman-save.1.md
+++ b/docs/podman-save.1.md
@@ -1,14 +1,13 @@
% podman-save(1)
## NAME
-podman\-save - Save an image to docker-archive or oci-archive
+podman\-save - Save an image to a container archive
## SYNOPSIS
**podman save** [*options*] *name*[:*tag*]
## DESCRIPTION
-**podman save** saves an image to either **docker-archive**, **oci-archive**, **oci-dir** (directory
-with oci manifest type), or **docker-dir** (directory with v2s2 manifest type) on the local machine,
+**podman save** saves an image to either **docker-archive**, **oci-archive**, **oci-dir** (directory with oci manifest type), or **docker-dir** (directory with v2s2 manifest type) on the local machine,
default is **docker-archive**. **podman save** writes to STDOUT by default and can be redirected to a
file using the **output** flag. The **quiet** flag suppresses the output when set.
Note: `:` is a restricted character and cannot be part of the file name.
diff --git a/install.md b/install.md
index 071eeff67..5fe150db2 100644
--- a/install.md
+++ b/install.md
@@ -268,7 +268,6 @@ registries = []
# If you need to block pull access from a registry, uncomment the section below
# and add the registries fully-qualified name.
#
-# Docker only
[registries.block]
registries = []
```