summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-01-19 13:20:53 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2022-02-18 12:35:25 +1100
commitdb4d15e852c574a2f2f4039cfef4814982776544 (patch)
treeedbac426dffcba771617b21bc390fb61675cba31 /libpod
parentd615ab81f9f8bbed5f335683f4bbcdda0e789ee1 (diff)
downloadpodman-db4d15e852c574a2f2f4039cfef4814982776544.tar.gz
podman-db4d15e852c574a2f2f4039cfef4814982776544.tar.bz2
podman-db4d15e852c574a2f2f4039cfef4814982776544.zip
Propagate $CONTAINERS_CONF to conmon
The CONTAINERS_CONF environment variable can be used to override the configuration file, which is useful for testing. However, at the moment this variable is not propagated to conmon. That means in particular, that conmon can't propagate it back to podman when invoking its --exit-command. The mismatch in configuration between the starting and cleaning up podman instances can cause a variety of errors. This patch also adds two related test cases. One checks explicitly that the correct CONTAINERS_CONF value appears in conmon's environment. The other checks for a possible specific impact of this bug: if we use a nonstandard name for the runtime (even if its path is just a regular crun), then the podman container cleanup invoked at container exit will fail. That has the effect of meaning that a container started with -d --rm won't be correctly removed once complete. Fixes #12917 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/oci_conmon_linux.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 268a301fb..a328f7621 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1318,6 +1318,10 @@ func (r *ConmonOCIRuntime) configureConmonEnv(ctr *Container, runtimeDir string)
env = append(env, e)
}
}
+ conf, ok := os.LookupEnv("CONTAINERS_CONF")
+ if ok {
+ env = append(env, fmt.Sprintf("CONTAINERS_CONF=%s", conf))
+ }
env = append(env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", runtimeDir))
env = append(env, fmt.Sprintf("_CONTAINERS_USERNS_CONFIGURED=%s", os.Getenv("_CONTAINERS_USERNS_CONFIGURED")))
env = append(env, fmt.Sprintf("_CONTAINERS_ROOTLESS_UID=%s", os.Getenv("_CONTAINERS_ROOTLESS_UID")))