How to create a droplet from docker-machine

July 26, 2016 568 views
Docker DigitalOcean Ubuntu

A few weeks ago, I created a droplet using docker-machine by following these articles as my guide:


Everything worked fine and I was able to see the droplet on my dashboard.

Since then I upgraded from Mountain Lion to El Capitan and re-installed docker toolbox. I don't recall the versions of docker the docker toolbox loaded previously, but now I'm using:

docker-machine version 0.7.0, build a650a40

docker-compose version 1.7.1, build 0a9ab35
docker-py version: 1.8.1
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1j 15 Oct 2014

docker version
Version: 1.11.2
API version: 1.23
Go version: go1.5.4
Git commit: b9f10c9
Built: Wed Jun 1 21:20:08 2016
OS/Arch: darwin/amd64

Now, when I try to create a new droplet using docker-machine I get the following error:

docker-machine create --driver digitalocean --digitalocean-access-token xxxxx docker-sandbox
Running pre-create checks...
Creating machine...
(docker-sandbox) Creating SSH key...
(docker-sandbox) 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 something changed in the DigitalOcean API in the last few weeks that now causes this command to fail? Does El Capitan not support this ability with Docker? Or, am I missing some important component when I did the re-install?

I sure would like to be able to use this capability, as it seems like it would be very beneficial.

Thanks in advance for any assistance you can offer.

1 Answer
ryanpq MOD July 27, 2016
Accepted Answer

There has not been any recent change to the create API endpoint that could cause this issue. From the output provided the actual error coming from DigitalOcean is

422 You specified an invalid image for Droplet creation.

This means that the DigitalOcean disk image specified could not be used. This value can either be an image slug like ubuntu-14-04-x64 for our stock Ubuntu 14.04 image or docker for our Docker One-Click image or it can be an image ID number which can identify a snapshot image on your account. There are a few reasons this error could happen.

1.) The image specified does not exist.

2.) The image specified does not exist in the data center you have specified (you can move an image to more regions from the Images section of the control panel)

3.) The image specified does not belong to the account you are using (an image can be transferred to a new account from the Images section of the control panel if needed).

  • Thanks for the reply, Ryan. Although I didn't mention it in the question I posted yesterday, I had already tested launching this by adding an option for --digitalocean-image ubuntu-14-04-x64, but for some reason I still got an error, however, it was different than the one I listed above.

    But, when I executed the following command today it worked:

    docker-machine create --driver digitalocean --digitalocean-access-token xxxxx --digitalocean-image docker docker-sandbox

    So, I guess for whatever reason, I can no longer create a droplet without an image option as I did a few weeks ago.

    Thanks for you help.

    • This may be related to the issue that was fixed here. While in this case it was the Ubuntu 15.10 image, it appears that docker-machine had a hardcoded image ID in it that was causing issues.

Have another answer? Share your knowledge.