"tls: oversized record received with length 20527" trying to "docker run" from Win10 WSL Bash only
Asked Answered
T

3

8

reproduction

Latest Docker Edge (18.03.0-ce-rc1-win54 (16164)) installed on Win10.

Switched to "Linux Container" before updated to latest Docker CE Edge version (but latest "Docker for Windows" UI don't show the switch option anymore?!).

No problem to run docker run hello-world from Windows CMD.

But calling the same from WSL Bash (latest Win10 1709) always respond with this tls error message:

$ docker images
REPOSITORY                        TAG                        IMAGE ID            CREATED             SIZE
continuumio/miniconda3            latest                     29af5106b6a4        17 hours ago        443 MB
hello-world                       latest                     f2a91732366c        3 months ago        1.85 kB

$ docker --version
Docker version 1.13.1, build 092cba3

$ docker version
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.6.2
 Git commit:   092cba3
 Built:        Thu Nov  2 20:40:23 2017
 OS/Arch:      linux/amd64

Server:
 Version:      18.03.0-ce-rc1
 API version:  1.37 (minimum version 1.12)
 Go version:   go1.9.4
 Git commit:   c160c73
 Built:        Thu Feb 22 02:42:37 2018
 OS/Arch:      linux/amd64
 Experimental: true

$ echo $DOCKER_HOST
tcp://0.0.0.0:2375

$ docker run hello-world
tls: oversized record received with length 20527

This setting seems unrelated, but necessary to run the docker command at all:

Expose daemon on tcp://localhost:2375 without TLS

question

I wonder why this is not a common reported problem for Windows Docker / WSL usage. Something seems to be messed up, but I've no clue where to start to look into.

For example:

  1. Why does the problem only appear under WSL Bash and not Windows CMD?
  2. How to change daemon.json value for "insecure-registries": [] as some SO related messages advice?

Any help / pointers are appreciated!

(=PA=)

Telophase answered 1/3, 2018 at 12:31 Comment(1)
This is clearly a TLS/no-TLS confusion because the server is obviously responding HTTP/... (without TLS) and the client is trying to parse this as a TLS response which involves taking bytes 3 and 4 = P slash = hex 50 2F as the length and hex 502F = decimal 20527 is indeed an invalid length. HTH.Cresol
T
6

Solution

As this freaked me out a bit, I made another Google session and found the solution down in the comments of this side: * https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

In a nutshell: * The issue I've described comes from an default but outdated docker.io installation, instead of the latest and maintained docker-ce installation.

Once I've removed the old one with (the trailing * is intended!):

sudo apt-get remove --purge docker*

and installed the latest docker-ce one -- according to the procedure described on the page above -- the TLS issue was gone!

Happy docking.

Telophase answered 16/3, 2018 at 14:10 Comment(0)
H
2

The proposed solution

sudo apt-get remove --purge docker*

didn't work for me since as soon as I tried to run the apt-get remove command I got the following error:

No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.

So I had to manually uninstall docker by executing this:

sudo rm /var/lib/dpkg/info/docker.io.*
sudo rm /var/cache/apt/archives/docker.io*
sudo rm /etc/default/docker
sudo rm /etc/init.d/docker
sudo rm /etc/init/docker.conf

and after that I just followed the instruction here:

https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

Problem fixed.

Handicapper answered 8/8, 2018 at 4:40 Comment(0)
N
1

Here are the steps to solve the problem:

  1. Remove docker.io (if present) and related packages from WSL (Ubuntu):

    sudo apt-get remove docker.io
    sudo apt-get remove docker*
    

    Note: In case of errors (function not implemented), try to upgrade WSL by (it'll take a while):

    sudo -S apt-mark hold procps strace sudo
    sudo -S env RELEASE_UPGRADER_NO_SCREEN=1 do-release-upgrade
    
  2. Install Docker CE in WSL (Ubuntu):

    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    sudo apt-get install docker-ce
    
  3. Expose daemon without TLS in your Docker app on Windows.

  4. Connect to it by defining DOCKER_HOST variable in WSL:

    export DOCKER_HOST=:2375
    

Related:

Nigrify answered 4/10, 2018 at 16:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.