Merge pull request #198 from QiWang19/engine-env

Add env to [engines] for engine to use
This commit is contained in:
Valentin Rothberg 2020-06-30 12:14:48 +02:00 committed by GitHub
commit cb7eb87dad
5 changed files with 30 additions and 0 deletions

View File

@ -271,6 +271,11 @@ they cannot be reused by other programs on the host. However, this can cause
significant memory usage if a container has many ports forwarded to it. significant memory usage if a container has many ports forwarded to it.
Disabling this can save memory. Disabling this can save memory.
**env**=[]
Environment variables to be used when running the container engine. For example "http_proxy=internal.proxy.company.com".
Note these environment variables will not be used within the container. Set the env section under [containers] table,
if you want to set environment variables for the container.
**events_logger**="journald" **events_logger**="journald"
Default method to use when logging events. Default method to use when logging events.
Valid values: `file`, `journald`, and `none`. Valid values: `file`, `journald`, and `none`.

View File

@ -207,6 +207,9 @@ type EngineConfig struct {
// memory. // memory.
EnablePortReservation bool `toml:"enable_port_reservation,omitempty"` EnablePortReservation bool `toml:"enable_port_reservation,omitempty"`
// Environment variables to be used when running the container engine. For example "http_proxy=internal.proxy.company.com"
Env []string `toml:"env,omitempty"`
// EventsLogFilePath is where the events log is stored. // EventsLogFilePath is where the events log is stored.
EventsLogFilePath string `toml:"events_logfile_path,omitempty"` EventsLogFilePath string `toml:"events_logfile_path,omitempty"`

View File

@ -168,6 +168,16 @@ var _ = Describe("Config Local", func() {
gomega.Expect(err).NotTo(gomega.BeNil()) gomega.Expect(err).NotTo(gomega.BeNil())
}) })
It("should return containers engine env", func() {
// Given
expectedEnv := []string{"http_proxy=internal.proxy.company.com", "foo=bar"}
// When
config, err := NewConfig("testdata/containers_default.conf")
// Then
gomega.Expect(err).To(gomega.BeNil())
gomega.Expect(config.Engine.Env).To(gomega.BeEquivalentTo(expectedEnv))
})
It("Expect Remote to be False", func() { It("Expect Remote to be False", func() {
// Given // Given
// When // When

View File

@ -279,6 +279,12 @@
# #
# enable_port_reservation = true # enable_port_reservation = true
# Environment variables to be used when running the container engine.
# For example "http_proxy=internal.proxy.company.com".
# Note these environment variables will not be used within the container.
# Set the env section under [containers] table, if you want to set environment variables for the container.
# env = []
# Selects which logging mechanism to use for container engine events. # Selects which logging mechanism to use for container engine events.
# Valid values are `journald`, `file` and `none`. # Valid values are `journald`, `file` and `none`.
# #

View File

@ -127,6 +127,12 @@ conmon_path = [
"/usr/local/sbin/conmon" "/usr/local/sbin/conmon"
] ]
# Environment variables to be used when running the container engine.
# For example "http_proxy=internal.proxy.company.com".
# Note these environment variables will not be used within the container.
# Set the env section under [containers] table, if you want to set environment variables for the container.
env = ["http_proxy=internal.proxy.company.com", "foo=bar"]
# Container init binary # Container init binary
#init_path = "/usr/libexec/podman/catatonit" #init_path = "/usr/libexec/podman/catatonit"