for-win icon indicating copy to clipboard operation
for-win copied to clipboard

[WSL] Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?

Open maxoyed opened this issue 7 years ago • 15 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: B8B66D54-EA07-4F2B-BB6A-03443045A59A/20190315005129

Expected behavior

Run docker info correctly under WSL.

Actual behavior

Cannot connect to the Docker daemon at tcp://127.0.0.1:2375.

Information

  • Windows Version: Windows10 1809(PF0I6WPO)
  • Docker for Windows Version: 2.0.0.3 (31259)
  • WSL Version: Snipaste_2019-03-15_01-01-19

Steps to reproduce the behavior

  1. Go to Docker Settings->General->Expose daemon on tcp://localhost:2375 without TLS Snipaste_2019-03-15_00-53-51

  2. Open WSL terminal and export DOCKER_HOST=127.0.0.1:2375

  3. Run docker info unber WSL, and get the Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running? Snipaste_2019-03-15_00-57-46

maxoyed avatar Mar 14 '19 17:03 maxoyed

I already fixed this issue. (By purge my Hyper-V environment and re-create a docker machine)

maxoyed avatar Mar 15 '19 18:03 maxoyed

I had the same issue after installing the latest Windows updates and wanted to shed some light on what I did to make it work again.

First I tried to reinstall Docker for Windows, to no avail. Then I tried to remove the Hyper-V VM ... but that still didn't help either.

What finally did the trick was going to "Turn Windows features on or off", deselect "Hyper-V", restart, go to "Turn Windows features on or off" again, select "Hyper-V" again and restart a last time. Afterwards docker was reachable again.

bigwhoop avatar Jun 11 '19 17:06 bigwhoop

This fixed the issue for me:

Check to see if windows is listening on port 2375 by running netstat -ano | findstr 2375. If it isn't listening and docker is running w/ the "Expose daemon on tcp://localhost:2375 without TLS" then my issue might be the same thing you're experiencing. Do the following:

netsh interface ipv4 show excludedportrange protocol=tcp

if you see a port range listed that includes port 2375, you can confirm that this is likely your issue.

Disable hyper-v and reboot Run netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1 to reserve port 2375 Enable hyper-v and reboot

Hope this helps!

danpalmer-niceincontact avatar Sep 26 '19 01:09 danpalmer-niceincontact

Thank you, @danpalmer-niceincontact, this fixed my system. Do you have an idea what could have caused this? Multiple network adapters, internet sharing, ...?

StarGate01 avatar Oct 07 '19 18:10 StarGate01

nestat -ano | findstr 2375

*netstat -ano | findstr 2375

xXGoziXx avatar Jan 16 '20 20:01 xXGoziXx

nestat -ano | findstr 2375

*netstat -ano | findstr 2375

fixed my typo, thanks

danpalmer-niceincontact avatar Jan 16 '20 21:01 danpalmer-niceincontact

Follow following steps for window 10 docker version : Version 2.0.0.3 (31259) or above Step 1: Right click on "Dcoker Desktop is running icon " Step 2: click on Settings Step 3: In “General Tab” you must enable checkbox “Expose Demon on tcp://localhost:2375 without TLS”

Nareshgitty avatar Jan 20 '20 14:01 Nareshgitty

This fixed the issue for me:

Check to see if windows is listening on port 2375 by running netstat -ano | findstr 2375. If it isn't listening and docker is running w/ the "Expose daemon on tcp://localhost:2375 without TLS" then my issue might be the same thing you're experiencing. Do the following:

netsh interface ipv4 show excludedportrange protocol=tcp

if you see a port range listed that includes port 2375, you can confirm that this is likely your issue.

Disable hyper-v and reboot Run netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1 to reserve port 2375 Enable hyper-v and reboot

Hope this helps!

Thanks this worked!

maximgeerinck avatar Feb 03 '20 19:02 maximgeerinck

Tried it... Still no luck... :(

netstat -ano | findstr 2375 TCP 127.0.0.1:2375 0.0.0.0:0 LISTENING 13120

Still not working... docker context ls $ docker context ls NAME DESCRIPTION DOCKER ENDPOINT KUBERNETES ENDPOINT ORCHESTRATOR default * Current DOCKER_HOST based configuration tcp://127.0.0.1:2375 swarm Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --contex t flag, or unset DOCKER_HOST environment variable.

docker ps $ docker ps Cannot connect to the Docker daemon at tcp://127.0.0.1:2375. Is the docker daemon running?

netsh gives the following: `netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges Start Port End Port


  2375        2375     *
 50051       50051     *
 54404       54503
 54504       54603
 54604       54703
 54704       54803
 54804       54903
 54904       55003
 55004       55103
 55104       55203
 55204       55303
    • Administered port exclusions.`

dsmith73 avatar Apr 08 '20 18:04 dsmith73

i'm exhibitying the same issue.

#3570

what i ran (windows bash ubuntu18.04)

>docker run -it hello-world

what i expected

"Hello from Docker!...."

what happend

docker: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?.
See 'docker run --help'.

what ive tried

@danpalmer-niceincontact solution,

  • turned off hyper-v
  • rebooted,
  • turn on hyper v.

my system info

my system was updated by docker to use the new wsl 2

docker context ls

NAME                DESCRIPTION                               DOCKER ENDPOINT        KUBERNETES ENDPOINT                                 ORCHESTRATOR
default *           Current DOCKER_HOST based configuration   tcp://localhost:2375   https://kubernetes.docker.internal:6443 (default)   swarm
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.

docker ps

docker -v
Docker version 19.03.6, build 369ce74a3c

docker wsl 2

wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu-18.04           Running         2
  kali-linux             Stopped         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

windows version

any thoughts?

wisehackermonkey avatar May 13 '20 21:05 wisehackermonkey

I did every step by the official guide, then this issue occurs. I tried to remove the variable export DOCKER_HOST=tcp://localhost:2735 from ~/.zshrc on my WSL Ubuntu, and then restarted terminal, after that, it works properly with command docker version on WSL. If you guys using ~/.bashrc, maybe you try to remove the variable from your ~/.bashrc.

OS: Windows 10 build 19041 WSL2: Ubuntu 18.04 Docker Desktop: 2.3.0.2(45183)

# WSL Ubuntu
$ docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
# Win10
❯ docker version
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:23:10 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

simonmatt avatar May 15 '20 13:05 simonmatt

Isso corrigiu o problema para mim:

Verifique se o Windows está escutando na porta 2375 executando netstat -ano | findstr 2375. Se ele não estiver ouvindo e o docker estiver em execução com o "Daemon Expose no tcp: // localhost: 2375 sem TLS", meu problema pode ser o mesmo que você está enfrentando. Faça o seguinte:

netsh interface ipv4 show excludedportrange protocol=tcp

se você vir um intervalo de portas listado que inclua a porta 2375, poderá confirmar que esse é provavelmente o seu problema.

Desativar hyper-v e reinicialização Execute netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1para reservar a porta 2375 Ativar hyper-v e reinicialize

Espero que isto ajude!

@danpalmer-niceincontact ! You certainly helped a lot to clear my head. But, the determinant was the hint of @simonmatt ( https://github.com/docker/for-win/issues/3570#issuecomment-629239998 ) Thank you very much!

In my bash file I remove two lines: export DOCKER_HOST=tcp://localhost:2735 export DOCKER_HOST=tcp://127.0.0.1:2735

I restarted the terminal and it worked fine!

OS: Windows 10 build 19041

WSL2: Ubuntu 18.04

Docker Desktop: 2.3.0.2(45183)

#WSL UBUNTU $ docker version Client: Docker Engine - Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:25:46 2020 OS/Arch: linux/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.8 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:29:16 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

andre-orion avatar May 17 '20 14:05 andre-orion

@andre-orion : perfect, I did the same and it worked for me! After removing this line from .bashrc file and restarting terminal it worked fine! Thanks a lot!

momcilo-vukovic avatar May 22 '20 22:05 momcilo-vukovic

Confirming the fix!

nano ~/.bashrc

Disable the following line: export DOCKER_HOST=tcp://localhost:2735

Vacilando avatar Jun 25 '20 21:06 Vacilando

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jul 25 '20 03:07 docker-robott