docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.96k forks source link

Docker service stop request aborts machine create if service not available #707

Open smo921 opened 9 years ago

smo921 commented 9 years ago

When creating a new instance, the process attempts to stop the existing docker service. If Docker is not already installed this causes the 'service docker stop' command to fail, which in turn aborts the 'docker-machine create'. This causes an issue for individuals using private machine images that do not already have Docker installed. I ran into this using the OpenStack driver but it shouldn't be specific to any particular driver.

EDIT: Added further debug messages so you can see it step through the process.

INFO[0001] Creating machine... DEBU[0003] Waiting for the OpenStack instance to be ACTIVE... MachineId=XXXXXXXXXX DEBU[0019] Looking for the IP address... MachineId=XXXXXXXXXX DEBU[0019] IP address found IP=XXXXXXXX MachineId=XXXXXXXXXXX DEBU[0019] Waiting for the SSH server to be started... IP=XXXXXXXX MachineId=XXXXXXXXXXX DEBU[0040] generating server cert: /home/USERNAME/.docker/machine/machines/foo/server.pem ca-key=/home/USERNAME/.docker/machine/certs/ca.pem private-key=/home/USERNAME/.docker/machine/certs/ca-key.pem org=foo
DEBU[0041] Stopping Docker...
DEBU[0041] Command: %s[sudo sh -c 'sudo service docker stop'] MachineId=XXXXXXXXXXXXXDEBU[0041] executing: ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -p 22 -i /home/USERNAME/.docker/machine/machines/foo/id_rsa deploy@XXXXXXXXX sudo sh -c 'sudo service docker stop' ERRO[0041] Error creating machine: exit status 255
WARN[0041] You will want to check the provider to make sure the machine and associated resources were properly removed. FATA[0041] Error creating machine

nathanleclaire commented 9 years ago

This strikes me as odd, since we shouldn't be stopping/restarting the Docker service before Docker has been installed. @ggiamarchi any input?

dgageot commented 8 years ago

@smo921 Can you try with latest version of Docker Machine Please?