summaryrefslogtreecommitdiff
path: root/cmd/kpod
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-11-27 10:12:24 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-27 16:41:08 +0000
commit61e0ab4f47b63039152a5576a2f9a1741d45b654 (patch)
tree5cf672c2366619800d020fea0f6ba79812704f2d /cmd/kpod
parent548f1516dedbd9574f624967d7022d52eb4d6c13 (diff)
downloadpodman-61e0ab4f47b63039152a5576a2f9a1741d45b654.tar.gz
podman-61e0ab4f47b63039152a5576a2f9a1741d45b654.tar.bz2
podman-61e0ab4f47b63039152a5576a2f9a1741d45b654.zip
Create|Run container from Image ID
As reported in Issue #50, we need to be able to run or create a container based on an image ID (as well as name). Signed-off-by: baude <bbaude@redhat.com> Closes: #76 Approved by: rhatdan
Diffstat (limited to 'cmd/kpod')
-rw-r--r--cmd/kpod/create.go12
-rw-r--r--cmd/kpod/run.go12
2 files changed, 24 insertions, 0 deletions
diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go
index 2684f8927..30837e7df 100644
--- a/cmd/kpod/create.go
+++ b/cmd/kpod/create.go
@@ -171,6 +171,18 @@ func createCmd(c *cli.Context) error {
return err
}
if createImage.LocalName != "" {
+ nameIsID, err := runtime.IsImageID(createImage.LocalName)
+ if err != nil {
+ return err
+ }
+ if nameIsID {
+ // If the input from the user is an ID, then we need to get the image
+ // name for cstorage
+ createImage.LocalName, err = createImage.GetNameByID()
+ if err != nil {
+ return err
+ }
+ }
imageName = createImage.LocalName
} else {
imageName, err = createImage.GetFQName()
diff --git a/cmd/kpod/run.go b/cmd/kpod/run.go
index 275654f65..b79ba5121 100644
--- a/cmd/kpod/run.go
+++ b/cmd/kpod/run.go
@@ -54,6 +54,18 @@ func runCmd(c *cli.Context) error {
logrus.Debug("spec is ", runtimeSpec)
if createImage.LocalName != "" {
+ nameIsID, err := runtime.IsImageID(createImage.LocalName)
+ if err != nil {
+ return err
+ }
+ if nameIsID {
+ // If the input from the user is an ID, then we need to get the image
+ // name for cstorage
+ createImage.LocalName, err = createImage.GetNameByID()
+ if err != nil {
+ return err
+ }
+ }
imageName = createImage.LocalName
} else {
imageName, err = createImage.GetFQName()