1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Skip KernelMemoryTCP if version is less than 1.40

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-10-27 17:44:52 +00:00
parent f023816608
commit ee74cd777a
2 changed files with 8 additions and 0 deletions

View file

@ -475,6 +475,12 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
}
}
// 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") {
hostConfig.KernelMemoryTCP = 0
}
ccr, err := s.backend.ContainerCreate(types.ContainerCreateConfig{
Name: name,
Config: config,

View file

@ -8,6 +8,7 @@ import (
"time"
containertypes "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/integration/internal/container"
"github.com/docker/docker/internal/test/request"
"gotest.tools/assert"
@ -18,6 +19,7 @@ import (
func TestKernelTCPMemory(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "skip test from new feature")
skip.If(t, !testEnv.DaemonInfo.KernelMemoryTCP)
defer setupTest(t)()