summaryrefslogtreecommitdiff
path: root/api/server
diff options
context:
space:
mode:
authorPaweł Gronowski <pawel.gronowski@docker.com>2022-05-12 14:54:44 +0200
committerPaweł Gronowski <pawel.gronowski@docker.com>2022-05-19 07:57:27 +0200
commit85a7f5a09af9c2d387c89df4d9de61c4322a2843 (patch)
treefcaa79645c8c65f160906fd5a6c5ef4636cdb057 /api/server
parent1a0587bd766e3ab1f6dbe808a94a41a2f54d9126 (diff)
downloaddocker-85a7f5a09af9c2d387c89df4d9de61c4322a2843.tar.gz
daemon/linux: Set console size on creation
On Linux the daemon was not respecting the HostConfig.ConsoleSize property and relied on cli initializing the tty size after the container was created. This caused a delay between container creation and the tty actually being resized. This is also a small change to the api description, because HostConfig.ConsoleSize is no longer Windows-only. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Diffstat (limited to 'api/server')
-rw-r--r--api/server/router/container/container_routes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/api/server/router/container/container_routes.go b/api/server/router/container/container_routes.go
index 287611ad86..db821942db 100644
--- a/api/server/router/container/container_routes.go
+++ b/api/server/router/container/container_routes.go
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
+ "runtime"
"strconv"
"github.com/containerd/containerd/platforms"
@@ -517,6 +518,11 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
hostConfig.KernelMemory = 0
}
+ if hostConfig != nil && runtime.GOOS == "linux" && versions.LessThan(version, "1.42") {
+ // ConsoleSize is not respected by Linux daemon before API 1.42
+ hostConfig.ConsoleSize = [2]uint{0, 0}
+ }
+
var platform *specs.Platform
if versions.GreaterThanOrEqualTo(version, "1.41") {
if v := r.Form.Get("platform"); v != "" {