Skip to content

Commit ee74cd7

Browse files
committed
Skip KernelMemoryTCP if version is less than 1.40
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
1 parent f023816 commit ee74cd7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

api/server/router/container/container_routes.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
475475
}
476476
}
477477

478+
// When using API 1.39 and under, KernelMemoryTCP should be ignored because it
479+
// was added in API 1.40.
480+
if hostConfig != nil && versions.LessThan(version, "1.40") {
481+
hostConfig.KernelMemoryTCP = 0
482+
}
483+
478484
ccr, err := s.backend.ContainerCreate(types.ContainerCreateConfig{
479485
Name: name,
480486
Config: config,

integration/container/run_linux_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"time"
99

1010
containertypes "github.com/docker/docker/api/types/container"
11+
"github.com/docker/docker/api/types/versions"
1112
"github.com/docker/docker/integration/internal/container"
1213
"github.com/docker/docker/internal/test/request"
1314
"gotest.tools/assert"
@@ -18,6 +19,7 @@ import (
1819

1920
func TestKernelTCPMemory(t *testing.T) {
2021
skip.If(t, testEnv.DaemonInfo.OSType != "linux")
22+
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "skip test from new feature")
2123
skip.If(t, !testEnv.DaemonInfo.KernelMemoryTCP)
2224

2325
defer setupTest(t)()

0 commit comments

Comments
 (0)