summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-09-15 15:36:00 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-15 16:35:55 +0200
commit0b1c45bc542636d48abcc3980baa02b9a65f57a9 (patch)
treeb1a5caf7393b66923cb0e14298a55a6181bb8dc1 /pkg/domain/infra
parent4dd7bfdfaa3adf95af39fd45f74d49cea0c80064 (diff)
downloadpodman-0b1c45bc542636d48abcc3980baa02b9a65f57a9.tar.gz
podman-0b1c45bc542636d48abcc3980baa02b9a65f57a9.tar.bz2
podman-0b1c45bc542636d48abcc3980baa02b9a65f57a9.zip
container runlabel remove image tag from name
When no name is given for podman container runlabel it will default to the image base name. However this can contain a tag. Since podman does not accept container names with a colon the run command will fail if it contains something like `podman run --name NAME ...`. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2004263 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/containers_runlabel.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers_runlabel.go b/pkg/domain/infra/abi/containers_runlabel.go
index d448627dc..435baa8c8 100644
--- a/pkg/domain/infra/abi/containers_runlabel.go
+++ b/pkg/domain/infra/abi/containers_runlabel.go
@@ -133,6 +133,9 @@ func generateRunlabelCommand(runlabel string, img *libimage.Image, inputName str
}
splitImageName := strings.Split(normalize, "/")
name = splitImageName[len(splitImageName)-1]
+ // make sure to remove the tag from the image name, otherwise the name cannot
+ // be used as container name because a colon is an illegal character
+ name = strings.SplitN(name, ":", 2)[0]
}
// Append the user-specified arguments to the runlabel (command).