"docker-machine create" with aws ec2 driver is failing using Mac and default AWS Ubuntu AMI

Hi,

Just to report that it appears that the AMI being used by docker-machine when running docker-machine create --driver amazonec2 aws01 is failing after provisioning the instance and trying to start Docker. It reports the following error:

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "***.***.***.***:2376": dial tcp ***.***.***.***:2376: i/o timeout
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.

When you try to run the regenerate-certs command it also fails because it cannot find the docker daemon in the remote ec2 instance.

I figured that maybe it was an Amazon AMI problem with that specific default ec2 instance image. Therefore, I forced the docker-machine create command to use a specific AMI (the latest Ubuntu image available in AWS EC2) and it worked flawlessly! This is the command I used that worked perfectly:

docker-machine create --driver amazonec2 --amazonec2-zone=b --amazonec2-ami=ami-40d28157 aws02

I think that maybe the issue is solved by only updating the docker-machine version used in the docker toolbox for the Mac. FYI I am using Docker version: 583d1b8ffe and Docker Machine version: 0.8.2, build e18a919.

Let me know if you need any more info.

Regards.

2 Likes

I am having the same issue for two days.
I have been trying to solve.

when I create a machine it creates in AWS and I can SSH to it when complete with docker-machine ssh tester as seen below.
here is the command line output from my last docker-machine createā€¦
docker-machine create --driver amazonec2 --amazonec2-instance-type t2.micro --amazonec2-zone a tester
Running pre-create checksā€¦
Creating machineā€¦
(tester) Launching instanceā€¦
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 ubuntu(systemd)ā€¦
Installing Dockerā€¦
Copying certs to the local machine directoryā€¦
Copying certs to the remote machineā€¦
Setting Docker configuration on the remote daemonā€¦
Checking connection to Dockerā€¦
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host ā€œServerIP:2376ā€: dial tcp ServerIP:2376: getsockopt: connection refused
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.

don.mccullough at canaries-mbp in ~ $ docker-machine ssh tester ā–øā–øā–øā–øā–øā–øā–øā–øā–øā–ø
Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-18-generic x86_64)

Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud

ubuntu@tester:~$

the weird thing is the keys are in place
when I region keys This repeated over and over
command : sudo docker version
err : exit status 1
output : Client:
Version: 1.12.4
API version: 1.24
Go version: go1.6.4
Git commit: 1564f02
Built: Mon Dec 12 23:59:32 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!

docker --version on my Mac
Docker version 1.12.3, build 6b644ec
docker --version on the tester instance
Docker version 1.12.4, build 1564f02

running docker on my mac
Version 1.12.3 (13776)
Channel: Stable
583d1b8ffe
docker-machine ls shows this error
tester - amazonec2 Running tcp://InstanceIP:2376 Unknown Unable to query docker version: Cannot connect to the docker engine endpoint

any help would be appreciated!

I fixed this by avoiding the default Ubuntu 15.10 AMI and selecting the 16.04 LTS image

here is my docker-machine create command for your reference. You need to look up the Image reference for the region you are using.

Ubuntu 15.10 seems to have issues with Docker engine!

docker-machine create --driver amazonec2 --amazonec2-instance-type t2.micro --amazonec2-zone a --amazonec2-ami ami-40d28157 tester3

no more issues hehe!

Yes, that was the same exact thing that happened to me and fixed it using your same AMI image (view my post above). I am glad someone else is experimenting it since I thought it was only me given that thereā€™s no talk about this problem anywhere else!

Definitely the default AMI used by docker-machine should be changed to the Ubuntu 16.04 latest image to avoid these issues.

Hi ,

I had the same problem. Mine was because the instance was not talking with the internet. I sshā€™d into the instance with docker-machine ssh <name_of_the_machine> and check /etc/resolv.conf it should have nameserver 169.254.169.253 .

Come back and try regenerate-certs (this worked for me)

Try Docker Machine 0.9.0-rc2. The base AMIs have been bumped but it hasnā€™t been released in the latest version yet.