mirror of
https://github.com/containers/podman.git
synced 2025-05-20 16:47:39 +08:00
pass LISTEN_* environment into container
Make sure that Podman passes the LISTEN_* environment into containers. Similar to runc, LISTEN_PID is set to 1. Also remove conditionally passing the LISTEN_FDS as extra files. The condition was wrong (inverted) and introduced to fix #3572 which related to running under varlink which has been dropped entirely with Podman 3.0. Note that the NOTIFY_SOCKET and LISTEN_* variables are cleared when running `system service`. Fixes: #10443 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -773,6 +773,18 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Pass down the LISTEN_* environment (see #10443).
|
||||
for _, key := range []string{"LISTEN_PID", "LISTEN_FDS", "LISTEN_FDNAMES"} {
|
||||
if val, ok := os.LookupEnv(key); ok {
|
||||
// Force the PID to `1` since we cannot rely on (all
|
||||
// versions of) all runtimes to do it for us.
|
||||
if key == "LISTEN_PID" {
|
||||
val = "1"
|
||||
}
|
||||
g.AddProcessEnv(key, val)
|
||||
}
|
||||
}
|
||||
|
||||
return g.Config, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user