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

Failed to connect. Is Docker installed and running? #1582

Closed
workermonkeyrobot opened this issue Jan 23, 2020 · 16 comments
Closed

Failed to connect. Is Docker installed and running? #1582

workermonkeyrobot opened this issue Jan 23, 2020 · 16 comments
Assignees
Milestone

Comments

@workermonkeyrobot
Copy link

I am having trouble connecting to the Docker viewer on the left hand side of the screen. When I remote SSH into my linux Ubuntu 18.04 machine, I get the following errors in the Docker viewer:

Failed to connect. Is Docker installed and running?
Error: DOCKER_HOST env variable shoule be something like tcp://localhost:1234

I have verified that the Docker extension v0.9.0 is installed on the SSH - Remote target machine as well as my local machine.

I have also followed the instructions from:
https://docs.docker.com/install/linux/linux-postinstall/

The post installation instructions helped me so that I can run "docker run hello-world" without the sudo command. I have also tried unsetting the DOCKER_HOST env as well as setting:
export DOCKER_HOST=tcp://127.0.0.1:2375
in my ~/.bashrc file. In both conditions, the Docker viewer would not populate.

Please let me know what I can do to proceed.

Thank you,

Aaron

@karolz-ms karolz-ms self-assigned this Jan 23, 2020
@dbreshears dbreshears added this to the 0.11.0 milestone Jan 24, 2020
@karolz-ms
Copy link
Contributor

I can reproduce. Investigating...

@workermonkeyrobot
Copy link
Author

workermonkeyrobot commented Jan 25, 2020 via email

@karolz-ms
Copy link
Contributor

So at least for me the issue seems to be that VS Code (incorrectly) does not offer me the option to install Docker extension on the remote machine.

I found a workaround:

  1. Uninstall Docker extension from VS Code. Close all VS Code windows.
  2. Start VS Code again. Use `Remote-SSH: Connect to Host..' to connect to remote machine (new VS Code instance will open).
  3. Open extension marketplace and install Docker extension on the remote machine (see screenshot below)

install-docker

  1. Once the Docker extension is installed remotely, it can also be installed locally.

@workermonkeyrobot can you let us know if this workaround works for you?

@workermonkeyrobot
Copy link
Author

workermonkeyrobot commented Jan 28, 2020 via email

@workermonkeyrobot
Copy link
Author

docker-droplet-inst
docker-droplet-inst-2

@karolz-ms
Copy link
Contributor

@workermonkeyrobot understood.

I cannot reproduce the issue that you are observing. What is the exact error message that you are seeing (the one related to DOCKER_HOST)?

Also, how exactly are you setting up your Docker environment? I followed instructions from Docker https://docs.docker.com/install/linux/docker-ce/ubuntu/ pretty much verbatim and don't see a problem one over the Docker extension remote installation hurdle. I do not have access to DigitalOcean environments but maybe you can provide us with step-by-step instructions, or a Vagrant file that will help us reproduce the issue in-house?

@workermonkeyrobot
Copy link
Author

The error message reads "Error: DOCKER_HOST env variable should be something like tcp://localhost:1234". This message comes up when I expand any of the "Failed to connect. Is Docker installed and running?" warnings. Last week when I was using Docker extension 0.9.0, the DOCKER_HOST message would remain expanded after I click. Now with 0.10.0 it only expands for less than 1 second then collapses. That's why I couldn't get it in the screenshot.

SSH:billyboy is my Droplet that I started with Ubuntu 18.04 then followed the same instructions from the link that you suggested.

I like your suggestion of the Vagrant file. I plan to install Vagrant and VirtualBox to see if the issue may have something to do with DigitalOcean. It may be a few days before I get to it but I hope to post some feedback by early next week.

DOCKER_HOST error

@karolz-ms
Copy link
Contributor

Roger. Is the DOCKER_HOST variable set in your environment?

@workermonkeyrobot
Copy link
Author

I followed the instructions from https://docs.docker.com/install/linux/linux-postinstall/ . These instructions say to unset the DOCKER_HOST env variable.

I also tried to set:
export DOCKER_HOST=tcp://127.0.0.1:2375
in my ~/.bashrc file. In both conditions, the Docker viewer would not populate.

@karolz-ms
Copy link
Contributor

Yeah, on my machine the DOCKER_HOST variable is not set and it is working ... 😐

@workermonkeyrobot
Copy link
Author

I installed Vagrant / VirtualBox and ran the following command:
vagrant init pogosoftware/ubuntu-18.04-docker
This seemed to give me a functional Ubuntu machine. I was able to connect via Remote-SSH and execute "docker run hello-world" without sudo. My Docker extension in VS Code still could not connect and gave me the same DOCKER_HOST error.

Unless you see any problem with my Vagrant init command, it looks like my problem is likely to be on my local installation of VS Code (running on Windows 10 Home). I have confirmed that the Docker extension is installed on my SSH:vagrant box and not on the local instance. Later this evening I may try to uninstall VS Code and reinstall to see if that helps.

Please let me know if there is anything else that you can think of for me to check.

@karolz-ms
Copy link
Contributor

karolz-ms commented Jan 30, 2020

I tried the box you listed above and was able to get the VS Code Docker extension to work with it without any difficulties. This was from yet another client machine (an Ubuntu box).

Please let us know if VS Code re-installation helps! You might want to try the portable mode that isolates the whole VS Code installation really well. Please let us know if that helps!

@workermonkeyrobot
Copy link
Author

I uninstalled VS Code then installed the following version using the .exe installer:
Version: 1.41.1 (user setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362

The Docker extension still had the same problem. Then I downloaded VSCode-win32-x64-1.41.1.zip. After unzipping the contents, I was able to log into my vagrant box and the Docker extension works just fine! I also created a new Digital Ocean droplet with Ubuntu 18.04 and Docker... The Docker extension worked just fine there as well.

It looks like the portable mode installation was the solution. I would like to get the installed version of VS Code to work if possible. I'm not too thrilled about the portable mode because I like to right click in File Explorer and select "open with VS Code". I also like to access VS Code from the Start menu.

Is there anything that I can do to fix the installed instance of VS Code?

@karolz-ms
Copy link
Contributor

Glad the extension is working for you ☺️

Try installing VS Code portable via scoop.

scoop bucket add extras
scoop install vscode-portable

This should take care of Start Menu/Open With shortcuts. It is the way I run VS Code on Windows.

@AlexSerbinov
Copy link

AlexSerbinov commented Feb 17, 2020

I have the same problem on my first droplet, but when connected to another droplet everything works fine, and I don’t understand why so

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

No branches or pull requests

4 participants