简体   繁体   中英

“tls: oversized record received with length 20527” trying to “docker run” from Win10 WSL Bash only

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=)

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.

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.

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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM