Skip to content

Unable to connect to WSL2 host IP after update to 2.1.6.0 #5167

@JoshuaCWebDeveloper

Description

@JoshuaCWebDeveloper

After updating to the WSL2 Backend on Docker Desktop 2.1.6.0, I am unable to connect to the WSL2 host from within the container using the ip address obtained from running ip route from within the container.

I understand that this is a bit of a generic issue; however, the below steps work fine using the WSL2 Tech Preview on Docker Desktop 2.1.0.0; after updating to the WSL2 Backend on Docker Desktop 2.1.6.0, they no longer work.

Diagnostic Id

3EE432E3-080A-4607-B654-B887F9447E4C/20191118202258

Steps to reproduce the behavior

  1. Update from Docker Desktop 2.1.0.0 to Docker Desktop 2.1.6.0
  2. Enable WSL 2 Engine
  3. Switch on WSL Integration Ubuntu-18.04
  4. Apply & Restart
  5. In WSL2 Ubuntu-18, run sudo nc -l 80 to listen for incoming traffic
  6. Confirm that this will receive foreign requests by connecting to it from Windows using your WSL2 VM ip address
  7. After confirming, run sudo nc -l 80 again
  8. docker build an image from provided Dockerfile
  9. docker run -d a new container using the image
  10. docker exec $CONTAINER ip route where $CONTAINER is the container from step 9
  11. docker exec $CONTAINER wget $IP where $IP is the default route ip address from step 10

Dockerfile

FROM  ubuntu:18.04
USER root
RUN apt update && apt install -y wget iptables iproute2 curl jq
CMD sleep 1000

Expected behavior

Step 8 would result in a successful connection to the WSL2 host, and the HTTP header would be outputted by the sudo nc -l 80 command.

Actual behavior

Step 8 results in: Connecting to $IP:80... failed: Connection refused.

Logs from running step 8

[12:31:08.122][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy >> HEAD /_ping\n"
[12:31:08.124][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy << HEAD /_ping (1.0003ms)\n"
[12:31:08.148][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy >> GET /v1.40/containers/b3/json\n"
[12:31:08.161][APIRequestLogger  ][Info   ] [938340a2] <Server start> POST http://unix/usage
[12:31:08.162][APIRequestLogger  ][Info   ] [938340a2] <Server end> POST http://unix/usage -> 200 OK (took 0ms)
[12:31:08.165][APIRequestLogger  ][Info   ] [fb40cb20] <Server start> POST http://unix/usage
[12:31:08.165][APIRequestLogger  ][Info   ] [fb40cb20] <Server end> POST http://unix/usage -> 200 OK (took 0ms)
[12:31:08.153][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy << GET /v1.40/containers/b3/json (5.0011ms)\n"
[12:31:08.156][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy >> POST /v1.40/containers/b3/exec\n"
[12:31:08.158][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy << POST /v1.40/containers/b3/exec (2.0057ms)\n"
[12:31:08.159][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy >> POST /v1.40/exec/73179f3c3bee42b445cbddd101f1c479a9945a2b3f1ecbd916449c6f0d4ca7e1/start\n"
[12:31:08.165][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="Upgrading to raw stream"
[12:31:08.225][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy << POST /v1.40/exec/73179f3c3bee42b445cbddd101f1c479a9945a2b3f1ecbd916449c6f0d4ca7e1/start (65.9982ms)\n"
[12:31:08.226][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy >> GET /v1.40/exec/73179f3c3bee42b445cbddd101f1c479a9945a2b3f1ecbd916449c6f0d4ca7e1/json\n"
[12:31:08.229][ApiProxy          ][Info   ] time="2019-11-18T12:31:08-08:00" msg="proxy << GET /v1.40/exec/73179f3c3bee42b445cbddd101f1c479a9945a2b3f1ecbd916449c6f0d4ca7e1/json (3.0052ms)\n"
[12:31:11.613][FeedbackWindow    ][Info   ] Open logs

Information

Windows Insider Fast Ring build: 19023.vb_release.191108-1432
Docker Desktop Edge channel version: 2.1.6.0 (40740)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions