diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-14 17:28:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 17:28:57 +0200 |
commit | ac733032c19a711317edc889bd2cb6321ee3bbdf (patch) | |
tree | e89d80039ea1f6e6c674e457b13d9a25eb4394c4 /cmd | |
parent | c19f257181db6f2c8af1d208ef8c3c846593813e (diff) | |
parent | 8cae2978ef1b84708df1f872c2340ec109537996 (diff) | |
download | podman-ac733032c19a711317edc889bd2cb6321ee3bbdf.tar.gz podman-ac733032c19a711317edc889bd2cb6321ee3bbdf.tar.bz2 podman-ac733032c19a711317edc889bd2cb6321ee3bbdf.zip |
Merge pull request #11966 from Luap99/panic
Fix panic in container create compat api
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/common/create_opts.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 09ac61f2e..50d7c446d 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -104,15 +104,18 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, rtc *c addField(&builder, "target", m.Target) addField(&builder, "ro", strconv.FormatBool(m.ReadOnly)) addField(&builder, "consistency", string(m.Consistency)) - // Map any specialized mount options that intersect between *Options and cli options switch m.Type { case mount.TypeBind: - addField(&builder, "bind-propagation", string(m.BindOptions.Propagation)) - addField(&builder, "bind-nonrecursive", strconv.FormatBool(m.BindOptions.NonRecursive)) + if m.BindOptions != nil { + addField(&builder, "bind-propagation", string(m.BindOptions.Propagation)) + addField(&builder, "bind-nonrecursive", strconv.FormatBool(m.BindOptions.NonRecursive)) + } case mount.TypeTmpfs: - addField(&builder, "tmpfs-size", strconv.FormatInt(m.TmpfsOptions.SizeBytes, 10)) - addField(&builder, "tmpfs-mode", strconv.FormatUint(uint64(m.TmpfsOptions.Mode), 10)) + if m.TmpfsOptions != nil { + addField(&builder, "tmpfs-size", strconv.FormatInt(m.TmpfsOptions.SizeBytes, 10)) + addField(&builder, "tmpfs-mode", strconv.FormatUint(uint64(m.TmpfsOptions.Mode), 10)) + } case mount.TypeVolume: // All current VolumeOpts are handled above // See vendor/github.com/containers/common/pkg/parse/parse.go:ValidateVolumeOpts() |