mirror of
https://github.com/containers/podman.git
synced 2025-11-02 06:37:09 +08:00
Merge pull request #7851 from zhangguanzhang/fix-apiv2-ctr-workdir-and-env
[apiv2] don't ignore the ENV and WorkDir from the image
This commit is contained in:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user