summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-02-15 15:08:11 +0100
committerMatthew Heon <mheon@redhat.com>2021-02-18 10:45:35 -0500
commit8dc2fb2c78a8404341e9e037ee4418d876c26366 (patch)
tree5196b71ee8445b770f5819e4bf6b54ae702ecf06 /cmd
parent2f3ae7ce5bbe03db13acfa529b5a396e65de1655 (diff)
downloadpodman-8dc2fb2c78a8404341e9e037ee4418d876c26366.tar.gz
podman-8dc2fb2c78a8404341e9e037ee4418d876c26366.tar.bz2
podman-8dc2fb2c78a8404341e9e037ee4418d876c26366.zip
fix create container: handle empty host port
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/create_opts.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index d86a6d364..ee6165b1b 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -222,7 +222,11 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
// publish
for port, pbs := range cc.HostConfig.PortBindings {
for _, pb := range pbs {
- hostport, err := strconv.Atoi(pb.HostPort)
+ var hostport int
+ var err error
+ if pb.HostPort != "" {
+ hostport, err = strconv.Atoi(pb.HostPort)
+ }
if err != nil {
return nil, nil, err
}