summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/import.go8
-rw-r--r--cmd/podman/shared/parse/parse.go10
-rw-r--r--docs/podman-run.1.md3
-rw-r--r--libpod/image/image.go5
4 files changed, 23 insertions, 3 deletions
diff --git a/cmd/podman/import.go b/cmd/podman/import.go
index 70ea167cb..d49792f27 100644
--- a/cmd/podman/import.go
+++ b/cmd/podman/import.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared/parse"
"github.com/containers/libpod/pkg/adapter"
+ multierror "github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -69,8 +70,11 @@ func importCmd(c *cliconfig.ImportValues) error {
return errors.Errorf("too many arguments. Usage TARBALL [REFERENCE]")
}
- if err := parse.ValidateFileName(source); err != nil {
- return err
+ errFileName := parse.ValidateFileName(source)
+ errURL := parse.ValidURL(source)
+
+ if errFileName != nil && errURL != nil {
+ return multierror.Append(errFileName, errURL)
}
quiet := c.Quiet
diff --git a/cmd/podman/shared/parse/parse.go b/cmd/podman/shared/parse/parse.go
index a77002235..9fbc92fc3 100644
--- a/cmd/podman/shared/parse/parse.go
+++ b/cmd/podman/shared/parse/parse.go
@@ -7,6 +7,7 @@ import (
"bufio"
"fmt"
"net"
+ "net/url"
"os"
"regexp"
"strings"
@@ -162,3 +163,12 @@ func ValidateFileName(filename string) error {
}
return nil
}
+
+// ValidURL checks a string urlStr is a url or not
+func ValidURL(urlStr string) error {
+ _, err := url.ParseRequestURI(urlStr)
+ if err != nil {
+ return errors.Wrapf(err, "invalid url path: %q", urlStr)
+ }
+ return nil
+}
diff --git a/docs/podman-run.1.md b/docs/podman-run.1.md
index d6c7ae055..c4747d234 100644
--- a/docs/podman-run.1.md
+++ b/docs/podman-run.1.md
@@ -646,6 +646,9 @@ If specified, the first argument refers to an exploded container on the file sys
This is useful to run a container without requiring any image management, the rootfs
of the container is assumed to be managed externally.
+Note: On `SELinux` systems, the rootfs needs the correct label, which is by default
+`unconfined_u:object_r:container_file_t`.
+
**--security-opt**=*option*
Security Options
diff --git a/libpod/image/image.go b/libpod/image/image.go
index db50e3dbd..068491f28 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -1298,7 +1298,10 @@ func (i *Image) Comment(ctx context.Context, manifestType string) (string, error
if err != nil {
return "", err
}
- return ociv1Img.History[0].Comment, nil
+ if len(ociv1Img.History) > 0 {
+ return ociv1Img.History[0].Comment, nil
+ }
+ return "", nil
}
// Save writes a container image to the filesystem