docker-archive / toolbox

The Docker Toolbox
https://docker.com/toolbox
3.22k stars 1.23k forks source link

still having issues with "Error checking TLS connection: Host is not running" #453

Open rufuscasey opened 8 years ago

rufuscasey commented 8 years ago

perhaps this happens when i move location- maybe another reason- don't know. First error: "Cannot connect to the Docker daemon. Is the docker daemon running on this host?"

After running eval` "$(docker-machine env default)" this will sometimes fix. Other times, next error is: "Error checking TLS connection: Host is not running"

Could someone please explain error and fix? This is marked as closed but I seem to keep coming across same errors.

victusfate commented 8 years ago

I ran into a similar issue, believe this occurs when your VM is inactive. Here's how I remedied the situation

docker-machine rm default

after it's cleaned up you can create a new default machine (assuming you haven't heavily modified it, then you'll probably want to script/automate that with packer/terraform etc)

docker-machine create default --driver virtualbox
sagannotcarl commented 8 years ago

Removing and recreating the default machine worked for me.

joelittlejohn commented 8 years ago

Is there a more permanent fix for this? Right now I need to recreate the default machine every time I restart.

GeoffreyBooth commented 8 years ago

I get this error after every restart, and for me it’s fixed by running:

eval $(docker-machine env default)

I have that in my .zshrc, but somehow I need to run it again at the command line. Perhaps the Docker daemon isn’t initialized when the .zshrc version runs? Is there a better solution?

ghost commented 8 years ago

I get the same issue when I restart computer, and it's fixed by running another docker Mac App: Katematic.

zerocity commented 8 years ago

I use docker-machine restart default and it works fine.

joshenders commented 8 years ago

Affecting me as well, happens after a restart in every new interactive shell I invoke:

Last login: Fri May 13 00:21:18 on ttys005
Error checking TLS connection: Host is not running
jenders@jenders-mbp ~ :) $
alexamorales commented 8 years ago

For me works only recreation of docker-machine.

bikemule commented 8 years ago

docker-machine restart default followed by eval "$(docker-machine env default)" worked for me.

zoevanhavre commented 8 years ago

This happens if you do not specify the name of the machine you need, when not running the default machine. You just need to add the machine name to the docker-machine env <NAME> command :)

I.e. if you started your machine with

docker-machine start mymachine

You will need to run

docker-machine env mymachine

cassiopaeslemesc commented 8 years ago

👍

RealKanashii commented 8 years ago

Having the same problem. After restart it works for a few second showing the machine status connected, with the right IP (assigned via DHCP) on docker-machine ls and the same exact IP with docker-machine ip docker-vm. Then, if I wait a few seconds or I execute eval $(docker-machine env docker-vm) I get the same error message again (TLS error 'cause the tcp connection IP to the docker-vm is now 172.17.0.1). If I try then docker-machine ip docker-vm it shows me the 172.17.0.1 (docker0) again. The VM still having both IPs, eth0 and docker0 but the docker-machine is only looking for docker0 to connect.

It never happened before.

Restarting the vm with docker-machine restart docker-vm make the config return to normal and vm avaliable for some seconds.

Anyone with the same problem?

dementedhedgehog commented 8 years ago

Could this error:

Error checking TLS connection: Host is not running

be related to this issue: https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning

Certain Python platforms (specifically, versions of Python earlier than 2.7.9) have restrictions in their ssl module that limit the configuration that urllib3 can apply. In particular, this can cause HTTPS requests that would succeed on more featureful platforms to fail, and can cause certain security features to be unavailable.

I'm seeing the two together (with Python 2.7.6)... i.e. updating your python version may fix the problem?

wenshin commented 8 years ago

it seems need to start docker-machine again.

$ docker-machine start default
$ docker-machine env default
$ eval $(docker-machine env default)

works for me

alexamorales commented 8 years ago

Guys, just migrate to "native" docker app for mac :-)

cassiopaeslemesc commented 8 years ago

Whaat? Can't believe I didn't find this before. Way more features and stability and maps to your freaking localhost to everything so I don't have to wonder about my IP address. Thanks @alexamorales. Link for the lazy: http://www.docker.com/products/docker#/mac

ArunNadda commented 8 years ago

Got same error after my system restarted. I have 2 VMs setup with docker-machine, "default" and "test". After restart of my laptop, did not start "default". Because of which 'test' got different IP address than it had earlier.

anadda ~ $ docker-machine.exe ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
test      -        virtualbox   Running   tcp://192.168.99.100:2376           Unknown   Unable to query docker version: Get https://192.168.99.100:2376/v1.15/version: x509: certificate is valid for 192.168.99.101, not 192.168.99.100
default   -        virtualbox   Stopped                                       Unknown
anadda ~ $ 

anadda ~ $ docker-machine.exe env
Error checking TLS connection: Host is not running

Tried to setup env, but got below error.

anadda ~ $ docker-machine.exe env test
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": x509: certificate is valid for 192.168.99.101, not 192.168.99.100
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.

anadda ~ $ eval `"$(docker-machine env test)"`
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376": x509: certificate is valid for 192.168.99.101, not 192.168.99.100
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.

bash: : command not found

I had to regenerate certs to get it working.

anadda ~ $ docker-machine.exe regenerate-certs test
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
anadda ~ $

anadda ~ $ docker-machine.exe ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
test      -        virtualbox   Running   tcp://192.168.99.100:2376           v1.12.0
default   -        virtualbox   Stopped                                       Unknown

anadda ~ $ docker ps
An error occurred trying to connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

anadda ~ $ eval $(docker-machine.exe env test)

anadda ~ $ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
anadda ~ $
Jake-Smullin commented 8 years ago

This fix is actually a lot easier then most may think especially if you're using a Linux distribution like Ubuntu. Without sudo - [vagrant@localhost vagrant]$ docker version Client: Version: 1.12.1 API version: 1.24 Go version: go1.6.3 Git commit: 23cf638 Built:
OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host?

With sudo - [vagrant@localhost ~]$ sudo docker version Client: Version: 1.12.1 API version: 1.24 Go version: go1.6.3 Git commit: 23cf638 Built:
OS/Arch: linux/amd64

Server: Version: 1.12.1 API version: 1.24 Go version: go1.6.3 Git commit: 23cf638 Built:
OS/Arch: linux/amd64

Docker commands require sudo or to be run as root, many forget this and end up restarting or creating their default machine over and over again. This is as permanent fix as it gets if this was your issue.

reklis commented 8 years ago

Macs with older processors cannot run docker for mac, so there are still uses for brew install docker and brew install docker-machine

Of course the machine will not be started when you start your mac, so every time you reboot, you'll need to start it up before using it. Personally I don't want that to happen until I need docker, so I created a docker-start function and put that in my profile.

# in your zsh profile somewhere
function docker-start() {
  machine_status=$(docker-machine status)

  if [ "Stopped" == $machine_status ]
  then
    docker-machine start default
  fi

  eval "$(docker-machine env default)"
}

now when I go to use docker, if it's not running I can just call docker-start and it will load it and put it in my shell. If the machine is already running, it skips the start command and will fix the environment variables of the current shell.

ramlaxman commented 7 years ago

SOLVED :

OS: Windows 7 SP1 64 bits After this procedure I am able to run all docker commands in cmd of windows w/o admin privileges,

No need to do docker-machine rm default every time.

  1. Without admin privilege, use this command: docker-machine restart default

  2. Now, this one: docker-machine env default You will get following output: export DOCKER_TLS_VERIFY="1" export DOCKER_HOST="tcp://192.168.99.100:2376" export DOCKER_CERT_PATH="C:\Users\abc\.docker\machine\machines\default" export DOCKER_MACHINE_NAME="default" export COMPOSE_CONVERT_WINDOWS_PATHS="true"

  3. Now set all variables in "System" environment variable.

  4. Restart cmd and you will see all docker commands are working w/o any problems.

danman01 commented 7 years ago

If you migrated from docker-machine and are now on docker native mac osx app and still getting this error:

Check that env variable DOCKER_HOST is not still set to old docker installation: env | grep DOCKER

Remove that and see if it now works. Does for me. My DOCKER_HOST value was set in my bash_profile.

gusterwoei commented 7 years ago

docker-machine restart default worked perfectly for me! Thanks guys.

sepehr commented 7 years ago

Well, A lot of misleading yet endorsed answers here. The worst is rm and then a create. The restart is not necessary every single time you open up a new terminal.

As @reklis mentioned, you just need to check if the machine is not running and start it only in that case. Something along the lines of:

if [[ $(docker-machine status default) != "Running" ]]; then
    echo "Starting up the default docker machine..."
    docker-machine start default > /dev/null 2>&1
fi

eval $(docker-machine env default)

In your .zshrc.

stoune commented 7 years ago

I have Mac OS X and docker tray application is saying that docker is running, but on console it is saying it is not. The similar issue I have faced on Windows. For me it looks like some ghost enviroinent is creating by docker and is used by default.

➜  ~ eval $(docker-machine env default)
Error checking TLS connection: Host is not running

tray

1.5 year and no one from multi-billion dollar corporation was bothered to fix trivial bugs. Similar issue on windows. You have created multiple drivers: hyperkit/VirtualBox, Hyper-V/virtualBox. Documentation desn't and probably can't reflect all the differences. Very simple issues which should be fixed by installers or by docker tray application exist for years as workarrounds at stackoverflow.

jowo-io commented 6 years ago

try creating your docker machine like so: docker-machine create default && eval $(docker-machine env default)

whirlwin commented 6 years ago

On Mac, you just need to do the first part of victusfate's instructions.

docker-machine rm default
MironVeryanskiy commented 6 years ago

To avoid restarting the docker-machine, simply Run the docker-machine commands from a shell with elevated (admin) privileges. I stopped getting the TLS connection errors only when using an admin shell.

Jumwah commented 6 years ago

I was having this exact same problem running on Windows 10 with HyperV from the git bash (mintty). I tried to start up a couple of VMs I had been using with no problems a few days prior, I always go this

Starting "dock-vm-1"...
exit status 1

and I also got this

$ eval $(docker-machine env dock-vm-1)
Error checking TLS connection: Host is not running

As @MironVeryanskiy suggests, the problem was that I was need to run the shell as administrator. Just opening an elevated shell immediately gave me:

$ docker-machine restart dock-vm-1
Restarting "dock-vm-1"...
(dock-vm-1) Waiting for host to stop...
(dock-vm-1) Waiting for host to start...
Waiting for SSH to be available...
Detecting the provisioner...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

Rookie mistake :)

nixel2007 commented 4 years ago

for docker-machine on windows users: add your user to "Hyper-V Administrators" user group to run docker-machine commands without admin rights.

vinayaksatapute commented 4 years ago

I was running windows 10 home edition. And I was trying to run latest version of Docker Toolbox but hit with error message "This compute doesn't have VT-x/AMD-V enabled, enabling it in the BIOS is mandatory". So before I enabled the virtualization in BIOS,

1> I removed my existing 'default' virtual machine with below command. docker-machine rm default

Rebooted my laptop and enabled the Virtualization in BIOS Setup. (I am using HP iCore 5, x64 bit machine)

2> Created the new default vm with below command docker-machine create default --driver virtualbox *****output**** Running pre-create checks... Creating machine... (default) Copying C:\Users\hp.docker\machine\cache\boot2docker.iso to C:\Users\hp.docker\machine\machines\default\boot2docker.iso... (default) Creating VirtualBox VM... (default) Creating SSH key... (default) Starting the VM... (default) Check network to re-create if needed... (default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar. (default) Waiting for an IP... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Detecting the provisioner... Provisioning with boot2docker... Copying certs to the local machine directory... Copying certs to the remote machine... Setting Docker configuration on the remote daemon... Checking connection to Docker... Docker is up and running! To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default


3> But when I run the below command, I still had the error. docker version Client: Version: 19.03.1 API version: 1.40 Go version: go1.12.7 Git commit: 74b1e89e8a Built: Wed Jul 31 15:18:18 2019 OS/Arch: windows/amd64 Experimental: false

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: 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

So to overcome the above error

4> docker-machine env default SET DOCKER_TLS_VERIFY=1 SET DOCKER_HOST=tcp://192.168.99.100:2376 SET DOCKER_CERT_PATH=C:\Users\hp.docker\machine\machines\default SET DOCKER_MACHINE_NAME=default SET COMPOSE_CONVERT_WINDOWS_PATHS=true REM Run this command to configure your shell: REM @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

5> So to configure the Shell run the below command and this successfully setup the Docker Daemon. @FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i

6> Verify the docker client and server docker version Client: Version: 19.03.1 API version: 1.40 Go version: go1.12.7 Git commit: 74b1e89e8a Built: Wed Jul 31 15:18:18 2019 OS/Arch: windows/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea838 Built: Wed Nov 13 07:28:45 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683