Error creating DigitalOcean droplet using docker-machine

June 22, 2016 430 views
Docker DigitalOcean Ubuntu

Not sure if it's a DigitalOcean problem or docker-machine but I get this error repeatedly while trying to create a droplet on DO

$ docker-machine create --driver digitalocean --digitalocean-access-token=$TOKEN --digitalocean-region=sgp1 --digitalocean-image=ubuntu-14-04-x64 --digitalocean-size "1gb" staging
    Running pre-create checks...
    Creating machine...
    (staging) Creating SSH key...
    (staging) Creating Digital Ocean droplet...
    (staging) 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(upstart)...
    Installing Docker...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Error creating machine: Error running provisioning: Get https://api.digitalocean.com/v2/droplets/17900941: dial tcp: lookup api.digitalocean.com on read udp> i/o timeout

I am using following docker packages on Ubuntu 14.04

  $ docker-machine version
    docker-machine version 0.7.0, build a650a40

    $ docker version
     Version:      1.11.2
     API version:  1.23
     Go version:   go1.5.4
     Git commit:   b9f10c9
     Built:        Wed Jun  1 21:47:50 2016
     OS/Arch:      linux/amd64

     Version:      1.11.1
     API version:  1.23
     Go version:   go1.5.4
     Git commit:   5604cbe
     Built:        Wed Apr 27 00:34:20 2016
     OS/Arch:      linux/amd64
3 Answers

Hi @kampta

It looks like a DNS issue to me.
It's trying to resolve "api.digitalocean.com" on port 53 (DNS), but it seems that is not a proper DNS server.

Can you ping api.digitalocean.com on your server ?

  • Ping works fine

    $ ping api.digitalocean.com
    PING api.digitalocean.com ( 56(84) bytes of data.
    64 bytes from icmp_seq=1 ttl=55 time=47.3 ms
    64 bytes from icmp_seq=2 ttl=55 time=45.2 ms
    64 bytes from icmp_seq=3 ttl=55 time=45.0 ms
    64 bytes from icmp_seq=4 ttl=55 time=45.2 ms
    64 bytes from icmp_seq=5 ttl=55 time=45.4 ms
    --- api.digitalocean.com ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4005ms
    rtt min/avg/max/mdev = 45.060/45.648/47.329/0.890 ms

Not 100% sure but I solved the problem as following. I was developing in virtualbox machine and I ran the command when I started work

eval "$(docker-machine env local)"

So my docker-machine env was set to some variables, because of which running docker-machine create in the same terminal was causing DNS resolution problem.

Just started a new terminal and was able to create a DigitalOcean droplet without any problem.

Have another answer? Share your knowledge.