Search code examples
dockervirtualboxportforwarding

how to forward docker port 2375 from virtualbox to host os windows 10


I created a debian vm to have my docker host running on.

netstat

tcp 0 0 127.0.0.1:2375 0.0.0.0:* LISTEN 1260/dockerd

After that I setup port forwarding for port 2375 as described in many online tutorials.

enter image description here

Next I curl in the cmd of my windows 10 host os.

C:\Users\me>curl localhost:2375
curl: (56) Recv failure: Connection was reset

Notice that connecting to the VMs SSH port is working.

C:\Users\me>curl localhost:666
SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u1
Protocol mismatch.

Can anybody tell me what am I missing? Do I have to kinda allow port 2375 to be called from outside where the SSH port is allowed by default?


Solution

  • The issue is with your docker listening IP.

    tcp 0 0 127.0.0.1:2375 0.0.0.0:* LISTEN 1260/dockerd
    

    127.0.0.1 means it is only listening for connections generated from inside the VM.

    You should change your docker daemon to use 0.0.0.0:2375. Then your port forwarding would work