Merge pull request #28098 from yongtang/25099-oom_score_adj-empty-env
Fix `/proc/<pid>/oom_score_adj: invalid argument` error caused by empty env name Upstream-commit: c025049c27c2cc8a6f1f978769c89a1fdf07a6f3 Component: engine
This commit is contained in:
@ -15,6 +15,7 @@ import (
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
"github.com/docker/docker/pkg/truncindex"
|
||||
"github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/go-connections/nat"
|
||||
)
|
||||
|
||||
@ -232,6 +233,13 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *containertypes.HostCon
|
||||
return nil, fmt.Errorf("invalid hostname format: %s", config.Hostname)
|
||||
}
|
||||
}
|
||||
|
||||
// Validate if Env contains empty variable or not (e.g., ``, `=foo`)
|
||||
for _, env := range config.Env {
|
||||
if _, err := opts.ValidateEnv(env); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hostConfig == nil {
|
||||
|
||||
Reference in New Issue
Block a user