machine
machine copied to clipboard
Error when provisioning for Ubuntu Server 20.04 "Focal"
Caused by no focal
distro in https://download.docker.com/linux/ubuntu/dists/
Running pre-create checks...
Creating machine...
(machine) 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...
Error creating machine: Error running provisioning: error installing docker:
Error running "sudo apt-get update": ssh command error:
command : sudo apt-get update
err : exit status 100
output : Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease [89.1 kB]
Hit:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Ign:5 https://download.docker.com/linux/ubuntu focal InRelease
Err:6 https://download.docker.com/linux/ubuntu focal Release
404 Not Found [IP: 99.86.32.108 443]
Reading package lists...
E: The repository 'https://download.docker.com/linux/ubuntu focal Release' does not have a Release file.
I don't think this is an issue with docker-machine. Docker did not yet provide a build for Ubuntu 20.04 LTS (Focal Fossa), see https://download.docker.com/linux/ubuntu/dists/
Arguably, the issue is that docker-machine does not provide you with a friendlier (and earlier?) error.
Finally, the build for 20.04 is in! See https://download.docker.com/linux/ubuntu/dists/focal/
Well, now we have a bug!
Running pre-create checks...
Creating machine...
(test-ubuntu-focal) Creating SSH key...
(test-ubuntu-focal) Assuming Digital Ocean private SSH is located at ~/.ssh/id_rsa
(test-ubuntu-focal) Creating Digital Ocean droplet...
(test-ubuntu-focal) Waiting for IP address to be assigned to the Droplet...
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...
Error creating machine: Error running provisioning: error installing docker:
The communication ends here, sir!
Yeah, same as mine, no? The second code block in my OP is from digging around.
It was still probably an issue with the upstream Focal packages from docker, because now it started to work with not change to docker-machine:
docker-machine create --driver digitalocean --digitalocean-access-token dontlookdontlook --digitalocean-image ubuntu-20-04-x64 --digitalocean-size s-2vcpu-2gb --digitalocean-region lon1 myhostname
Running pre-create checks...
Creating machine...
(pen16) Creating SSH key...
(pen16) Creating Digital Ocean droplet...
(pen16) Waiting for IP address to be assigned to the Droplet...
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...
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 myhostname
I think this issue is still a "not a bug" and can be closed, after all :)
Ok, I agree that it's fixed now, but as you said it would be nice if it "provide you with a friendlier (and earlier?) error."
It seems like there's nothing following the colon in error installing docker:
Q. I get intermittent errors for this - is there a docker-machine command to reinstall docker (try again)?
My Answer: docker-machine provision {machine}
seems to work because the EC2 instance is created, it just needs to be provisioned.
$ docker-machine provision dazza-us-west-2-ec2-005
Waiting for SSH to be available...
Detecting the provisioner...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
I use a cloud-init shell script to provision a few things for 20.04, including docker:
- https://github.com/dazza-codes/docker-machine-ec2/blob/master/ec2_cloud_init.sh
- it is applied by setting
export AWS_USERDATA="${HOME}/bin/ec2_cloud_init.sh"
It includes
#
# Install docker and get `docker run hello-world` working on the box.
#
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
cat /etc/lsb-release
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
sudo apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo usermod -aG docker $USER
The docker-machine installation for docker seems to run after the cloud-init provision script
Running pre-create checks...
Creating machine...
(dazza-us-west-2-ec2-005) 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...
Error creating machine: Error running provisioning: error installing docker:
Most often, it just works, but not always, as above. Is there any reason docker-machine cannot detect that docker is already installed?