diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-01 10:00:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 10:00:15 -0400 |
commit | 3948cb76e266e930e0f1762b7145f72d65baf39f (patch) | |
tree | c9a6f8d79962dd1aa6a3b8a1824aafa024b14816 /pkg/api/handlers | |
parent | 556117c2e95bb0e4da7d36e10d94c3ec0ac4072f (diff) | |
parent | cde367c1c0b348366fcaf4d8fac3b753de8456d5 (diff) | |
download | podman-3948cb76e266e930e0f1762b7145f72d65baf39f.tar.gz podman-3948cb76e266e930e0f1762b7145f72d65baf39f.tar.bz2 podman-3948cb76e266e930e0f1762b7145f72d65baf39f.zip |
Merge pull request #7851 from zhangguanzhang/fix-apiv2-ctr-workdir-and-env
[apiv2] don't ignore the ENV and WorkDir from the image
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/containers_create.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go index 1d0b4c45d..0579da8de 100644 --- a/pkg/api/handlers/compat/containers_create.go +++ b/pkg/api/handlers/compat/containers_create.go @@ -82,7 +82,13 @@ func makeCreateConfig(ctx context.Context, containerConfig *config.Config, input } } - workDir := "/" + workDir, err := newImage.WorkingDir(ctx) + if err != nil { + return createconfig.CreateConfig{}, err + } + if workDir == "" { + workDir = "/" + } if len(input.WorkingDir) > 0 { workDir = input.WorkingDir } @@ -169,6 +175,11 @@ func makeCreateConfig(ctx context.Context, containerConfig *config.Config, input // away incorrectly formatted variables so we cannot reuse the // parsing of the env input // [Foo Other=one Blank=] + imgEnv, err := newImage.Env(ctx) + if err != nil { + return createconfig.CreateConfig{}, err + } + input.Env = append(imgEnv, input.Env...) for _, e := range input.Env { splitEnv := strings.Split(e, "=") switch len(splitEnv) { |