boot2docker - An error occurred trying to connect when running docker version command - windows-7

When I use boot2docker to start the boot2docker-vm, then in gitbash I run the docker version command I get the following:
$ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 7c8fca2
OS/Arch (client): windows/amd64
FATA[0021] An error occurred trying to connect: Get https://192.168.59.103:2376/v1.18/version: dial tcp 192.168.59.103:2376: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
However when I go into virtual box I see the boot2docker-vm is running.
When I stop the boot2docker-vm, & then start it myself - I can use the vm to use docker - it would be much easier to use gitbash to work with it...anyone have any ideas?

You have to init shell inside gitbash, use:
$ $(boot2docker shellinit)
in terminal.
Here is documentation for mac: https://docs.docker.com/installation/mac/.

This blog post describes the configuration of VirtualBox for Win64 systems after the boot2docker installation.
Change VirtualBox Global Settings to provide DHCP server on network adapter #2 instead of #3 with exactly the same settings as of #3
Change boot2docker-vm network configuration of the host-only network adapter from preconfigured adapter #3 to #2

Related

Connection refused from host into a linux container with Docker for Windows

I found a lot of material on this issue online, however I wasn't able to find a solution. Also majority of them are rather old (a few years) and things could have considerably changed meanwhile.
I have Docker Desktop Community v 2.3.0.3 running on my Windows machine and a simple container with Ubuntu and a Rails app running on localhost:5000 inside.
The container gets run using:
docker run -p 5000:5000 rails:6.0.3 foreman start
I would like to connect to the Rails app from my Windows host machine via browser, but connection gets refused.
The server is up and running:
> docker exec 3c167e206f60 wget localhost:5000
--2020-06-06 08:21:26-- http://localhost:5000/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Port forwarding doesn't seem to work correctly (run from WSL, but similarly from Windows via Chrome):
> wget localhost:5000
--2020-06-06 10:22:50-- http://localhost:5000/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:5000... failed: Connection refused.
It doesn't work when using container address instead of localhost, either:
> docker inspect --format '{{ .NetworkSettings.IPAddress }}' 3c167e206f60
172.17.0.2
> wget 172.17.0.2:5000
--2020-06-06 10:29:02-- http://172.17.0.2:5000/
Connecting to 172.17.0.2:5000... failed: Resource temporarily unavailable.
Also (as probably expected), I don't see any docker related entry in ifconfig (from WSL) or ipconfig (from Windows) output.
I also tried docker run --net host parameter, which didn't help either.
I would ideally prefer a solution which doesn't require me to modify the Windows host setup (network setup, etc), to avoid the possibility of breaking other scenarios.
I've been struggling with this issue for several days. What worked for me was to:
Uninstall Docker Desktop
Turn off the Hyper-V, Virtual Machine Platform, and Windows Hypervisor Platform via the Turn Windows Features On and Off control panel module
Reboot
Turn on all features in #2
Re-install Docker Desktop
This seems to reset all of the HyperV virtual networking interfaces. It's possible that uninstalling Docker Desktop isn't necessary but since it relies on at least some of these features I felt it wisest to do a complete cycle.

Docker-machine cannot connect to default machine (Windows)

I have problem with using docker-machine after windows update on my Windows 8.1 Enterprise.
I'm using Docker Toolbox 1.12.5. I can run docker with no problem, but after windows update docker-machine cannot connect to default machine.
I can see in VirtualBox that default machine is running, but when I tried to run
docker-machine env default
it gave me "Error checking TLS connection: Host is not running".
When I run
docker-machine ls
I get:
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default virtualbox Timeout
I found some suggestions to restart default machine so I ran
docker-machine restart default
but it always gives me following error:
Restarting "default"...
Starting "default"...
(default) Check network to re-create if needed...
Error setting up host only network on machine start: C:\Program Files\Oracle\Vir
tualBox\VBoxManage.exe modifyvm default --nic2 hostonly --nictype2 82540EM --nic
promisc2 deny --hostonlyadapter2 VirtualBox Host-Only Ethernet Adapter --cableco
nnected2 on failed:
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended in
fo not available)
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at lin
e 507 of file VBoxManageModifyVM.cpp
I tried solutions suggested on :
https://www.bountysource.com/issues/29373416-vboxmanage-exe-error-context-lockmachine-a-session-locktype_write-at-line-493-of-file-vboxmanagemodifyvm-cpp
and https://github.com/docker/toolbox/issues/360 without success.
I would really appreciate any suggestions.
Can you try restarting your system and then check?
Docker has released Community and Enterprise edition for docker. I would recommend you to upgrade to community edition and recreate your default machine using below command. They claim to have fixed some bugs in these editions.
docker-machine create --driver virtualbox default
you can add more parameters to above command if you want.

connected host has failed to respond when I run `docker run hello-world` in docker

The lastest version of docker(version 0.6) has been installed in my laptop (windows 10 LTSB) through the installation package docker toolbox. It seems to be installed correctly cause I see the logo of docker when I started the docker quickstart terminal. While when I run docker run hello-world, it returns
$ docker run hello-world
D:\Program Files\Docker Toolbox\docker.exe: An error occurred trying to connect: Post https://192.168.99.100:2376/v1.24/containers/create: dial tcp 192.168.99.100:2376: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond..
See 'D:\Program Files\Docker Toolbox\docker.exe run --help'.
By the way, I open the vpn through cisco anyconnect. However, when I disconnect the vpn and run the hello world, it seems to just froze at
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pulling fs layer
What happened? Can you find what's wrong with the docker or vpn?
You should first create a default machine (or start if already created):
docker-machine create default
Then get the environment commands for your new VM:
docker-machine env
And then connect your shell to the new machine:
eval "$(docker-machine env default)"
After then docker run hello-world is expected to work fine. I tested on Windows 10Pro with Docker-Toolbox

Docker and Windows - Problems with SSH on default container

i'm new to Docker and i've just intalled Docker ToolBox 1.11.1 on my Windows 7 (64 bit).
When running Quickstart Terminal i've got problems with creating default container.
After reading a bunch of forums i've invoked :
docker-machine rm -f default
docker-machine --debug create -d virtualbox default
But still without result. Full logs from last operation are :
https://gist.github.com/anonymous/117e302c047492170a6f0c7d4e79199a
They end up with phrase :
"(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:49659: connectex: No connection could be made because the target machine actively refused it."
I've have no idea how to fix that. Can someone help me ?
In windows and Mac OS Docker run in a virtual machine. When you install Docker using the Docker Toolbox, it takes care of install Virtual Box, create a “default” virtual machine and configure it to run a Boot2Docker image.
With the command:
docker-machine rm -f default
you are removing this default VM. Then running the command:
docker-machine --debug create -d virtualbox default
you are creating a new VM called “default”, so you are not creating or starting any default windows container.
"Actively refused it" means that the host sent a reset instead of an ack when you tried to connect. Please, check the firewall or the proxy configuration because this is a communication problem.
Hope this can help.

Error setting up docker on Windows

I am trying to set up docker machine on Windows and this problem has annoyed me for a few days.
I downloaded and installed DockerToolbox-1.9.1a on my Windows, so it came with Virtual Box version 5.0.10. After that I ran this command to create my virtual machine:
docker-machine create --driver virtualbox --engine-insecure-registry docker.pre-prod.ss.local:5000 --virtualbox-hostonly-cidr 192.168.99.100/24 mymachine
Here is what I got:
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available... Detecting
operating system of created instance... Detecting the provisioner...
Provisioning created instance... Copying certs to the local machine
directory... Copying certs to the remote machine... Setting Docker
configuration on the remote daemon... WARNING >>> This machine has
been allocated an IP address, but Docker Machine could not reach it
successfully.
SSH for the machine should still work, but connecting to exposed
ports, such as the Docker daemon port (usually :2376), may not
work properly.
You may need to add the route manually, or use another related
workaround
This could be due to a VPN, proxy, or host file configuration issue.
You also might want to clear any VirtualBox host only interfaces you
are not using
The machine was created successfully. So I ran the docker-machine env command:
docker-machine env --shell=powershell mymachine| Invoke-Expression
and I got:
Error running connection boilerplate: Error checking and/or
regenerating the certs: There was icates for host
"192.168.99.100:2376": dial tcp 192.168.99.100:2376: connectex: No
connection target machine actively refused it. 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.
Running docker version returned
Client: Version: 1.9.1 API version: 1.21 Go version:
go1.4.3 Git commit: a34a1d5 Built: Fri Nov 20 17:56:04 UTC
2015 OS/Arch: windows/amd64 An error occurred trying to connect:
Get http://localhost:2375/v1.21/version: dial tcp connection could be
made because the target machine actively refused it.
Can someone help to point out the direction to fix this issue? It is really troublesome to set up docker on Windows. Thank you very much.
I use docker 1.9.1 on Windows (7, 8 and even 10), but without docker registry, and without using --virtualbox-hostonly-cidr.
If you are to use that last option, check "Set a specific address ip when i create a docker container", where I mention issue 1709, which uses cidr in .1, not .100 (but getting a .100 ip address as a result):
docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.99.1/24" m99
If there's no other machine with the same cidr (Classless Inter-Domain Routing), the machine should always get the .100 IP upon start.

Resources