Merge pull request #38381 from thaJeztah/unify_api_version_checks

Unify API-version checks
This commit is contained in:
Akihiro Suda 2018-12-20 13:07:00 +09:00 committed by GitHub
commit f81cafd12b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -462,19 +462,14 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
hostConfig.AutoRemove = false
}
// When using API 1.39 and under, BindOptions.NonRecursive should be ignored because it
// was added in API 1.40.
if hostConfig != nil && versions.LessThan(version, "1.40") {
// Ignore BindOptions.NonRecursive because it was added in API 1.40.
for _, m := range hostConfig.Mounts {
if bo := m.BindOptions; bo != nil {
bo.NonRecursive = false
}
}
}
// When using API 1.39 and under, KernelMemoryTCP should be ignored because it
// was added in API 1.40.
if hostConfig != nil && versions.LessThan(version, "1.40") {
// Ignore KernelMemoryTCP because it was added in API 1.40.
hostConfig.KernelMemoryTCP = 0
}