Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions common/docs/containers.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions common/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down
4 changes: 4 additions & 0 deletions common/pkg/config/containers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions common/pkg/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func defaultConfig() (*Config, error) {
EnableLabeling: selinuxEnabled(),
Env: configfile.NewSlice(defaultContainerEnv),
EnvHost: false,
EnvMerge: []string{},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert in this part of code, but I think you should use configfile.Slice{} instead of []string{}. The reason is that without configfile.Slice{}, the https://github.com/containers/common/blob/main/docs/containers.conf.5.md#appending-to-string-arrays won't work.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct configfile.Slice must be used over normal string slices

HTTPProxy: true,
IPCNS: "shareable",
Init: false,
Expand Down
Loading