Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to Docker Machine #580

Closed
eduardonunesp opened this issue Oct 23, 2018 · 16 comments · Fixed by #998
Closed

Unable to connect to Docker Machine #580

eduardonunesp opened this issue Oct 23, 2018 · 16 comments · Fixed by #998
Labels
Milestone

Comments

@eduardonunesp
Copy link

Can't connect to docker even settings the DOCKER_HOST env var and on config file with DOCKER_HOST (tcp://192.168.99.100:2376)

Does that extension ever worked on macOS and Windows?

macOS: 10.14
VSCode: Version 1.28.2

@StephenWeatherford
Copy link
Contributor

@eduardonunesp Sorry you're having troubles. So you're trying to connect to Docker Machine? Have you followed the instructions at https://github.com/microsoft/vscode-docker#connecting-to-docker-machine?

@eduardonunesp
Copy link
Author

@StephenWeatherford NP, sorry if I sounded rude, actually I have set the environment variable also the docker.host option on config file without success. I have tried also an year ago and it didn't work also

@StephenWeatherford StephenWeatherford added this to the 0.5.0 milestone Oct 24, 2018
@StephenWeatherford StephenWeatherford changed the title Unable to connect to Docker, is the Docker daemon running? Unable to connect to Docker Machine Oct 24, 2018
@PrashanthCorp PrashanthCorp modified the milestones: 0.7.0, 0.6.0 Jan 22, 2019
@mrkz55
Copy link

mrkz55 commented Jan 31, 2019

Same issue on MacOS 10.14 running VSCode 1.30.2 (1.30.2). Is there a ballpark timeframe for the PR on this one?

@PrashanthCorp PrashanthCorp modified the milestones: 0.6.0, 0.7.0 Feb 26, 2019
@dr3x
Copy link

dr3x commented Mar 21, 2019

Same issue in Windows 10:

docker-machine start
& "C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe" env | Invoke-Expression
docker build --rm -f "Dockerfile" -t dr3x/dotnet-docker-vscode:latest .
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/build?
...
docker-vscode%3Alatest&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Went through several iterations of setting the environment variables as per:
https://docs.docker.com/machine/reference/env/

I'm using docker-machine with a local VM provider (Virtualbox)

**Update - more info:
Works / connects if I put exactly the same command in the terminal; only get the error if I launch Docker:Build Image from the Command Palette. Maybe some issue with the way it is launched from VC?

@akshaybabloo
Copy link

akshaybabloo commented Apr 3, 2019

I tried this setting:

"docker.host": "tcp://192.168.99.100:2376",
    "docker.importCertificates": {
        "useCertificateStore": true,
        "certificatePaths": [
            "/etc/ssl/certs/ca-certificates",
            "/etc/openssl/certs",
            "/etc/pki/tls/certs",
            "/usr/local/share/certs",
            "C:\\Users\\aksha\\.docker\\machine\\machines\\default"
        ]
    }

I get an error as (certificates are too big)

File size (4553637888) is greater than possible Buffer: 2147483647 bytes

and

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

@JDDoesDev
Copy link

Chiming in with the same issues as above. I've run eval $(docker-machine env vm) and the output of env | grep DOCKER is:

DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://192.168.64.100:2376
DOCKER_CERT_PATH=.../.docker/machine/machines/vm
DOCKER_MACHINE_NAME=vm

However, I'm unable to view my containers in my Docker Machine VM on the explorer. Is there a step that I'm missing in the settings?

@JDDoesDev
Copy link

Actually, I just happened across this issue microsoft/vscode#69728 and out of curiosity tried launching code from the command line. Looks like this solved the issue, but it's unintuitive. I can see all of my Docker Machine containers and attach VSCode (using Remote Containers and Insiders)

@deepio
Copy link

deepio commented May 14, 2019

  • Tried How to setup configs with docker-machine. #914 and could not reproduce the same error, but I did not get any further either.
  • @JDDoesDev I tried your solution and unfortunately it did not work for me, could you provide more information? Maybe I'm missing an important detail. I still see 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, even though I've set a the configs in settings.json, set the environment variables and started vscode using code from the terminal in which the env variables are set.
  • I've tried what @akshaybabloo said and got the same error File size (11848777728) is greater than possible Buffer: 2147483647 bytes on a mac. I do not believe it is correctly pointing to certificates because 11GB is huge for a certificate isn't it? It's actually pointing to a virtualbox disk file .vmdk for me, not the pem's or pub keys. Changing the path to point directly to the key file does remove this error, but I am still stuck with this error afterwards: 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 again, regardless of the suggestions above.

I would appreciate a fix for this soon, the extension works when i'm not using docker-toolbox but I need to run both docker and docker-toolbox on different machines at the same time.

@JDDoesDev
Copy link

JDDoesDev commented May 14, 2019

@deepio Did you use code or code-insiders? Also, after you run env | grep DOCKER what is the output?

Another question: are you changing out the vm in my command for the name of your docker machine?

EDIT: eval $(docker-machine env <YOUR MACHINE NAME HERE>) is what the command should look like

@JDDoesDev
Copy link

Reading back, I don't know whether or not docker toolbox is supported. is it possible for you to migrate from toolbox to docker machine instead or is that a non-starter?

@deepio
Copy link

deepio commented May 14, 2019

@JDDoesDev I really appreciate your speedy reply. I'm using code not code-insiders, I will try the latter. Yes, my vm is called default and i'm using default.

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.101:2376"
export DOCKER_CERT_PATH=".../.docker/machine/machines/default" # On my machine this is actually a symbolic link to another drive, but I don't think that should be an issue because docker runs just fine outside of vscode
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell: 
# eval $(docker-machine env)

Unfortunately I need to run both docker and docker-toolbox, it's not just one or the other. It would have been nice to have vscode integration for all the machines but I believe it might not be possible at this time.

Edit: I've also tried with the --no-proxy flag docker-machine env --no-proxy default

@JDDoesDev
Copy link

@deepio I'm sorry, code-insiders was for a different issue. Sometimes I git confused... yeah, I went there.

The output up there looks like something from a .*rc file or similar. What happens when you actually run eval $(docker-machine env) and then run env | grep DOCKER? I mean the actual output. Can you paste that?

@deepio
Copy link

deepio commented May 15, 2019

@JDDoesDev what I posted was just the output of docker-machine env, which gets executed by eval. env | grep DOCKER would just check to make sure those environment variables have been set in the shell and I can confirm that they are present and it still did not work. So sadly it would appear that this extension does not work with docker-toolbox at all.

@benad
Copy link

benad commented May 22, 2019

I found a fix. I've set docker.host like this, and it worked: "docker.host": "10.0.1.2:2376". Seems like the extension doesn't like the tcp:// prefix.

@XUWeijiang
Copy link

I found a fix. I've set docker.host like this, and it worked: "docker.host": "10.0.1.2:2376". Seems like the extension doesn't like the tcp:// prefix.

Save my day! Thank you very much!

@ejizba
Copy link
Member

ejizba commented Jun 17, 2019

Hi all - just merged #998 to support the following VS Code settings:

docker.host - equivalent to DOCKER_HOST
docker.certPath - equivalent to DOCKER_CERT_PATH
docker.tlsVerify - equivalent to DOCKER_TLS_VERIFY
docker.machineName - equivalent to DOCKER_MACHINE_NAME

Feel free to try the latest build from master and let us know if it works for ya! See these instructions: https://aka.ms/azCodeInsiders

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.