diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-08-18 09:17:41 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-08-28 06:06:08 -0400 |
commit | 60fe96118fcbf5beef4f58abd3dbe9dcb6cc49d0 (patch) | |
tree | d7e2c7b6c4b45a07de0b1d2554f99f75182e9f99 /cmd/podman/common/specgen.go | |
parent | 061c93f70101026d79cca6e75ac0c565e1fa99ec (diff) | |
download | podman-60fe96118fcbf5beef4f58abd3dbe9dcb6cc49d0.tar.gz podman-60fe96118fcbf5beef4f58abd3dbe9dcb6cc49d0.tar.bz2 podman-60fe96118fcbf5beef4f58abd3dbe9dcb6cc49d0.zip |
Use environment from containers.conf
podman needs to use the environment settings in containers.conf
when setting up the containers.
Also host environment variables should be relative to server side
not the client.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r-- | cmd/podman/common/specgen.go | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 4de622916..e7b88eb3f 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -307,10 +307,11 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string // ENVIRONMENT VARIABLES // // Precedence order (higher index wins): - // 1) env-host, 2) image data, 3) env-file, 4) env - env := map[string]string{ - "container": "podman", - } + // 1) containers.conf (EnvHost, EnvHTTP, Env) 2) image data, 3 User EnvHost/EnvHTTP, 4) env-file, 5) env + // containers.conf handled and image data handled on the server side + // user specified EnvHost and EnvHTTP handled on Server Side relative to Server + // env-file and env handled on client side + var env map[string]string // First transform the os env into a map. We need it for the labels later in // any case. @@ -319,24 +320,8 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string return errors.Wrap(err, "error parsing host environment variables") } - if c.EnvHost { - env = envLib.Join(env, osEnv) - } else if c.HTTPProxy { - for _, envSpec := range []string{ - "http_proxy", - "HTTP_PROXY", - "https_proxy", - "HTTPS_PROXY", - "ftp_proxy", - "FTP_PROXY", - "no_proxy", - "NO_PROXY", - } { - if v, ok := osEnv[envSpec]; ok { - env[envSpec] = v - } - } - } + s.EnvHost = c.EnvHost + s.HTTPProxy = c.HTTPProxy // env-file overrides any previous variables for _, f := range c.EnvFile { |