summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-03 18:58:10 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-04 17:51:33 +0000
commitca3b2414516c04125f986775c0cbce27f0f1e505 (patch)
treeecc11e761940ef25132c546dfc9a21d2412935c3 /cmd
parenteb0d5dfff1ecec97df71247bfb76748d60a666dc (diff)
downloadpodman-ca3b2414516c04125f986775c0cbce27f0f1e505.tar.gz
podman-ca3b2414516c04125f986775c0cbce27f0f1e505.tar.bz2
podman-ca3b2414516c04125f986775c0cbce27f0f1e505.zip
Run images with no names
When an image name has no reponames, you should still be able to run it by ID. When doing so, imageName needs to be set to "" so we don't hit an index out of range error Resolves: #587 Signed-off-by: baude <bbaude@redhat.com> Closes: #593 Approved by: mheon
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/run.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index 0c174a729..e9eaf83d2 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -32,6 +32,7 @@ var runCommand = cli.Command{
}
func runCmd(c *cli.Context) error {
+ var imageName string
if err := validateFlags(c, createFlags); err != nil {
return err
}
@@ -64,8 +65,12 @@ func runCmd(c *cli.Context) error {
if err != nil {
return err
}
-
- createConfig, err := parseCreateOpts(c, runtime, newImage.Names()[0], data)
+ if len(newImage.Names()) < 1 {
+ imageName = newImage.ID()
+ } else {
+ imageName = newImage.Names()[0]
+ }
+ createConfig, err := parseCreateOpts(c, runtime, imageName, data)
if err != nil {
return err
}