From 43d010bd0f9e01d1652e284c77d1839a4bf16607 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 24 Feb 2021 23:30:15 -0500 Subject: Fix parsing of Tmpfs field in compat create Create is not formatted as `key=value` but rather `key:value` (technically `path:option1,option2`). As such we can't use the stringMapToArray function, and instead need to generate it manually. Fixes #9511 Signed-off-by: Matthew Heon --- cmd/podman/common/create_opts.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'cmd/podman/common') diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index c1523b6c1..249355b94 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -311,6 +311,15 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup netInfo.CNINetworks = []string{string(cc.HostConfig.NetworkMode)} } + parsedTmp := make([]string, 0, len(cc.HostConfig.Tmpfs)) + for path, options := range cc.HostConfig.Tmpfs { + finalString := path + if options != "" { + finalString += ":" + options + } + parsedTmp = append(parsedTmp, finalString) + } + // Note: several options here are marked as "don't need". this is based // on speculation by Matt and I. We think that these come into play later // like with start. We believe this is just a difference in podman/compat @@ -367,7 +376,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup StorageOpt: stringMaptoArray(cc.HostConfig.StorageOpt), Sysctl: stringMaptoArray(cc.HostConfig.Sysctls), Systemd: "true", // podman default - TmpFS: stringMaptoArray(cc.HostConfig.Tmpfs), + TmpFS: parsedTmp, TTY: cc.Config.Tty, User: cc.Config.User, UserNS: string(cc.HostConfig.UsernsMode), -- cgit v1.2.3-54-g00ecf