Reputation: 27321
I'm following the docker get started docs, and I got stuck at the beginning of part 4 (https://docs.docker.com/get-started/part4/).
I'm on Windows 10, and I'm supposed to set up a couple of local VMs. I've created the virtual switch named "myswitch"
, but when I run
docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
it gives me the following error
c:\srv> docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm4
Running pre-create checks...
Creating machine...
(myvm4) Copying C:\Users\bjorn\.docker\machine\cache\boot2docker.iso to C:\Users\bjorn\.docker\machine\machines\myvm4\boot2docker.iso...
(myvm4) Creating SSH key...
(myvm4) Creating VM...
(myvm4) Using switch "myswitch"
(myvm4) Creating VHD
(myvm4) Starting VM...
(myvm4) Waiting for host to start...
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...
Error creating machine: Error running provisioning: ssh command error:
command : printf '%s' '-----BEGIN CERTIFICATE-----
MIICzjCCAbagAwIBAgIRAKtTNS/nB+OzHZ7r0PuiTpkwDQYJKoZIhvcNAQELBQAw
EDEOMAwGA1UEChMFYmpvcm4wHhcNMTkwNjAxMTY1NTAwWhcNMjIwNTE2MTY1NTAw
WjAQMQ4wDAYDVQQKEwViam9ybjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAJ4wTk7sUwVwzTvPVbTiL/pTEWxRFWFO6gxU1BuNXIk1fzLpT7wMy/R48md1
DdGgkAUH/FgnjyKY9YnIpvlLt+HpuZjBxBRWYGJZDkV2QzvLb6dOLgev3i/7/vN+
1OWrr3OkfDCyXsSF1r2/6mMtk3wNtWiV4vdqjM7XEFrfWN6vLDCxGXqN5S0U94D+
vCbZuh1w51M3ZTvdC8D9nA0PVoh2detHsNGXdv7AuunYBmWGahr8OZT45RhtYksx
nXyU3HjjUyugscsuQp3y9Iwo4qP1eoWX+qJXuXlc7gznKHNx1D+nr9qRanEj3YUF
JspjEJc4H6J6TqVn+u/JfjrH6ZsCAwEAAaMjMCEwDgYDVR0PAQH/BAQDAgKsMA8G
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBABFHjhI+OkVNdwM2qLL6
1wA7aeaLUi8GXUXjXjOxS3Vr7IZIejmvoAt/R6IpCmwFt2lL73JT7LB2cIR8hIVF
ZoQdTi1LBPyS2x0pKi5PHGN6O5UEVN0Y2aLkgpFxUZhtgqHTkeOaEPdWY6NHGWYR
8THT6LTT1cto/bqq07L5I+SsYwq/V+5JJhajqGLaoRonle4IUoDZTus4qaSbxcv/
ZO4rUW/w5Krn+QT31ku5pblAhGiNWtTQsP7+fQnfHT01PM0Hh1hBukAjRY2lImEo
URTKDR96IC3P2XFymXBcqHhZv13EKQQN5A8honxs10KxixlYhXTCg3W27L2FwzkU
WGo=
-----END CERTIFICATE-----
' | sudo tee /var/lib/boot2docker/ca.pem
err : exit status 1
output : bash: -c: line 0: unexpected EOF while looking for matching `''
bash: -c: line 1: syntax error: unexpected end of file
I'm running in a elevated command shell (I've also tried using powershell as administrator, with exactly the same result).
docker-machine ls
gives the following result (myvm1 and -2 are from my first attempt):
c:\srv> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
myvm1 - hyperv Unknown
myvm2 - hyperv Unknown
myvm3 - hyperv Running tcp://192.168.1.140:2376 Unknown Unable to query docker version: Get https://192.168.1.140:2376/v1.15/version: dial tcp 192.168.1.140:2376: connectex: No connection could be made because the target machine actively refused it.
myvm4 - hyperv Running tcp://192.168.1.141:2376 Unknown Unable to query docker version: Get https://192.168.1.141:2376/v1.15/version: dial tcp 192.168.1.141:2376: connectex: No connection could be made because the target machine actively refused it.
I can't continue with the next step in the tutorial:
c:\srv> docker-machine ssh myvm3 "docker swarm init --advertise-addr 192.168.1.140"
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
exit status 1
Any suggestions?
Upvotes: 0
Views: 2987
Reputation: 26
First of all, Make sure that the External Virtual Switch of Hyperv is connected to your appropriate Ethernet (or) Wi-Fi adapter. Refer image below
Now, run the below command in windows powershell or cmd (as Admin):
docker-machine --native-ssh create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" myvm1
using --native-ssh
prevents any random ssh.exe
from "somewhere else" from causing problems (c.f. https://github.com/docker/machine/issues/3511 for details).
Upvotes: 1
Reputation: 101
Are you running Docker Toolbox or Docker on windows ?
If its Docker on windows, I see the docker-machine create is misdirected to generate certs at "/var/lib/boot2docker/ca.pem". This is a boot2docker specific location.I am inclined to believe that either there is some vestige of Docker Toolbox left behind in your system or you need to clear the following env variables.
DOCKER_TLS_VERIFY
DOCKER_CERT_PATH
DOCKER_HOST
DOCKER_TOOLBOX_INSTALL_PATH
Docker init will fail for not finding the socket at unix:///var/run/docker.sock, which is expected since docker daemon is not up there.
Upvotes: 1