Docker Machine create - Error creating machine: Error in driver during machine creation: POST https://api.digitalocean.com/v2/droplets: 422 Image is not available

I’m getting this error when I’m trying to create a docker machine.

$ docker-machine create \

–driver digitalocean
–digitalocean-access-token ACCESSTOKEN
–digitalocean-image “ubuntu-16-04-x64”
–engine-install-url “https://releases.rancher.com/install-docker/19.03.9.sh
vidly
Running pre-create checks…
Creating machine…
(vidly) Creating SSH key…
(vidly) Creating Digital Ocean droplet…
Error creating machine: Error in driver during machine creation: POST https://api.digitalocean.com/v2/droplets: 422 You specified an invalid image for Droplet creation.

Has anyone run into this issue?

I had the same issue. Change the image to ubuntu-20-04-x64 to resolve the problem.

docker-machine create --driver digitalocean --digitalocean-access-token <TOKEN> --digitalocean-image ubuntu-20-04-x64 --digitalocean-region sfo3 --engine-install-url "https://releases.rancher.com/install-docker/19.03.9.sh" vidly

Although that will get your nginx server running, it won’t serve the frontend app static files (you will get the default nginx index.html page — I’m still trying to figure out how to configure nginx to actually serve the react build-step static assets. I’m convinced that Mosh just gave up on this project given the shady shortcuts he took at the end of the tutorial.

3 Likes

Ok. After you sort out the 422 error. You can follow the instructions here to configure nginx to serve the react static assets.

Great! Thank you. I was able to run the script you sent and get the docker machine to create, but then I ran into another error

Running pre-create checks...
Creating machine...
(vidly) Creating SSH key...
(vidly) Creating Digital Ocean droplet...
(vidly) 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)...
Error creating machine: Error running provisioning: Error running "sudo apt-get update": ssh command error:
command : sudo apt-get update
err     : exit status 100
output  : Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]

When I listed the docker machines, its listed but with an error:

NAME    ACTIVE   DRIVER         STATE     URL                          SWARM   DOCKER    ERRORS
vidly   -        digitalocean   Running   tcp://IP:2376           Unknown   Unable to query docker version: Get https://IP:2376/v1.15/version: dial tcp IP:2376: connectex: No connection could be made because the target machine actively refused it.

I went through the rest of the steps in the docker course and ran into this error:

$ docker-machine env vidly
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "ip:2376": dial tcp ip: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 might stop running containers.

I ran “docker-machine regenerate-certs vidly” and that fixed it and I was able to get through the rest of the production deployment.

docker-machine regenerate-certs vidly

Thanks so much for your help!

Thanks a lot @cesarnml ! God bless you !