diff --git a/common/docs/containers.conf.5.md b/common/docs/containers.conf.5.md index 39e368bc94..4fc1e90147 100644 --- a/common/docs/containers.conf.5.md +++ b/common/docs/containers.conf.5.md @@ -216,6 +216,14 @@ overwriting values specified on the command line when the container was created. Pass all host environment variables into the container. +**env_merge**=[] + +Preprocess default environment variables for the container. +Works the same as the **--env-merge** command line option. +The value of existing variables in the image will be used for substitution. + +Example: `env_merge=["PATH=${PATH}:/custom/bin"]` + **host_containers_internal_ip**="" Set the IP address the container should expect to connect to the host. The IP diff --git a/common/pkg/config/config.go b/common/pkg/config/config.go index 2ab2613495..a437388d25 100644 --- a/common/pkg/config/config.go +++ b/common/pkg/config/config.go @@ -142,6 +142,9 @@ type ContainersConfig struct { // EnvHost Pass all host environment variables into the container. EnvHost bool `toml:"env_host,omitempty"` + // EnvMerge preprocess the environment variables list for the container. + EnvMerge []string `toml:"env_merge,omitempty"` + // HostContainersInternalIP is used to set a specific host.containers.internal ip. HostContainersInternalIP string `toml:"host_containers_internal_ip,omitempty"` diff --git a/common/pkg/config/containers.conf b/common/pkg/config/containers.conf index 49fd38390b..0c7269cb3a 100644 --- a/common/pkg/config/containers.conf +++ b/common/pkg/config/containers.conf @@ -137,6 +137,10 @@ default_sysctls = [ # #env_host = false +# Preprocess default environment variables for the container. +# +#env_merge = [] + # Set the IP address the container should expect to connect to the host. The IP # address is used by Podman to automatically add the `host.containers.internal` # and `host.docker.internal` hostnames to the container's `/etc/hosts` file. It diff --git a/common/pkg/config/default.go b/common/pkg/config/default.go index 7ea362f6bc..d85d2226cf 100644 --- a/common/pkg/config/default.go +++ b/common/pkg/config/default.go @@ -218,6 +218,7 @@ func defaultConfig() (*Config, error) { EnableLabeling: selinuxEnabled(), Env: configfile.NewSlice(defaultContainerEnv), EnvHost: false, + EnvMerge: []string{}, HTTPProxy: true, IPCNS: "shareable", Init: false,