summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMatej Vasek <mvasek@redhat.com>2021-02-15 15:08:11 +0100
committerMatej Vasek <mvasek@redhat.com>2021-02-16 12:24:44 +0100
commit714acf32676d4e5f16d997d70958d093c6cc8fa3 (patch)
treeac97d0a2b3c58eb4c7e0c076205ae1a7a72eec91 /cmd
parentac9a048b59ebcbdfd2cb7abb50a97981892bd6b6 (diff)
downloadpodman-714acf32676d4e5f16d997d70958d093c6cc8fa3.tar.gz
podman-714acf32676d4e5f16d997d70958d093c6cc8fa3.tar.bz2
podman-714acf32676d4e5f16d997d70958d093c6cc8fa3.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 430354ee9..c1523b6c1 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -223,7 +223,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
}