0

I want to develop code inside a container on a remote Docker host with VS Code, but I cannot connect to Docker on the remote machine via SSH (ECONNREFUSED 127.0.0.1:80).

Following the VS Code instructions to use a SSH tunnel (https://code.visualstudio.com/docs/remote/containers-advanced#_option-2-connect-using-an-ssh-tunnel) I got this error:

"Unable to connect to Docker. Please make sure you have installed Docker and that it is running. Details: connect ECONNREFUSED 127.0.0.1:80"

I started VS Code (Windows 10), updated the docker.host (File->Preferences) property to:

{
    "docker.host":"tcp://localhost:23750"
}

and ran:

ssh -NL localhost:23750:/var/run/docker.sock user@hostname

It looked like established the tunnel successfully. I run Docker on a virtual machine (centOS).

When I opened the Docker view and expanded the Containers node in the explorer I got the above mentioned error. To me it looks like VS Code tries to connect to port 80 but I specified port 23750 in the settings. How can I successfully connect to the remote host?

Felix Popp
  • 1
  • 1
  • 1

2 Answers2

0

I found a fix here: https://github.com/microsoft/vscode-docker/issues/580

Remove the prefix tcp:// from the docker.host settings, e.g.:

"docker.host": "localhost:23750"

Alex R.
  • 1,397
  • 3
  • 18
  • 33
0

I know that this question is old but for anyone still looking for options I solved a similar issue on my computer using IPv6.

So in your case:

{
    "docker.host":"tcp://[::1]:23750"
}

I configured the host on the environment variable DOCKER_HOST.

Eric
  • 196
  • 1
  • 9