summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Munizaga <git@marcopolo.io>2020-11-19 11:21:40 -0800
committerMarco Munizaga <git@marcopolo.io>2020-11-23 10:26:02 -0800
commita8cb43d3a96f173a6f33f7f11325a51b55587a37 (patch)
treed66f510b2f7fb32552de9a75430acc219723659b
parente239bfa15ba7e5718b511e0f949679ba5b7037c4 (diff)
downloadpodman-a8cb43d3a96f173a6f33f7f11325a51b55587a37.tar.gz
podman-a8cb43d3a96f173a6f33f7f11325a51b55587a37.tar.bz2
podman-a8cb43d3a96f173a6f33f7f11325a51b55587a37.zip
Set PATH env in systemd timer.
This fixes an issue where binaries that are in the path of the original podman process are not found in the transient systemd timer for healthchecks. This showed up for me on a NixOS machine since binaries are not installed in the usual places. Signed-off-by: Marco Munizaga <git@marcopolo.io>
-rw-r--r--libpod/healthcheck_linux.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/healthcheck_linux.go b/libpod/healthcheck_linux.go
index b0f1ff35d..0ad15da09 100644
--- a/libpod/healthcheck_linux.go
+++ b/libpod/healthcheck_linux.go
@@ -26,6 +26,10 @@ func (c *Container) createTimer() error {
if rootless.IsRootless() {
cmd = append(cmd, "--user")
}
+ path := os.Getenv("PATH")
+ if path != "" {
+ cmd = append(cmd, "--setenv=PATH="+path)
+ }
cmd = append(cmd, "--unit", c.ID(), fmt.Sprintf("--on-unit-inactive=%s", c.HealthCheckConfig().Interval.String()), "--timer-property=AccuracySec=1s", podman, "healthcheck", "run", c.ID())
conn, err := systemd.ConnectToDBUS()