46

When I try to run docker-machine start default , I get Host does not exist: "default", I tried eval "$(docker-machine env default)", but still getting the same message. Where is the error ?

miltone
  • 4,416
  • 11
  • 42
  • 76
VPaskar
  • 667
  • 1
  • 6
  • 13

4 Answers4

52

Try simply to check what machine has been created (docker-machine ls):

docker-machine ls

Then you can pick one and try your commands with it.

If there is none, you can create one first (docker-machine create).
In the case of the OP:

docker-machine create default

Since the error message was:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

One of the answers of "Docker command can't connect to docker daemon" should work:

sudo service docker restart
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 3
    i get `Running pre-create checks... Error creating machine: Error with pre-create check: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path `, should i install Virtual box ? – VPaskar Jan 14 '16 at 11:19
  • If you are on a Mac, yes. – VonC Jan 14 '16 at 11:22
  • 1
    No, i'm using ubuntu. But actually, i need just to run `docker-compose up`, but i get this `ERROR: Couldn't connect to Docker daemon - you might need to run docker-machine start default` Could you suggest me something ? – VPaskar Jan 14 '16 at 11:29
  • @VPaskar Try to follow https://github.com/docker/compose/issues/2495#issuecomment-161764374 – VonC Jan 14 '16 at 11:32
  • 1
    not my case, i've read many posts about this problem, but none of those was the solution – VPaskar Jan 14 '16 at 11:46
  • @VPaskar no proxy at all? – VonC Jan 14 '16 at 11:46
  • @VPaskar What `docker info` and `docker env` return? – VonC Jan 14 '16 at 11:47
  • 1
    `Cannot connect to the Docker daemon. Is the docker daemon running on this host?` - docker info, `docker: 'env' is not a docker command.` - docker env – VPaskar Jan 14 '16 at 11:48
  • @VPaskar Sorry `docker version` – VonC Jan 14 '16 at 11:49
  • @VPaskar would one of the answers of http://stackoverflow.com/a/34024801/6309 help? – VonC Jan 14 '16 at 11:50
  • `Client: Version: 1.9.1 API version: 1.21 Go version: go1.4.2 Git commit: a34a1d5 Built: Fri Nov 20 13:16:54 UTC 2015 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host?` - the lastest – VPaskar Jan 14 '16 at 11:51
  • @VPaskar Try again the installation: `wget -qO- https://get.docker.com/gpg | sudo apt-key add -` (http://stackoverflow.com/a/33636041/6309). If not, what restarting the server return? (http://stackoverflow.com/a/33562183/6309) – VonC Jan 14 '16 at 11:53
  • I restarted the docker servise, and now it works. Thanks for your help! – VPaskar Jan 14 '16 at 11:55
  • @VPaskar Great! I have included your conclusion in the answer for more visibilty. – VonC Jan 14 '16 at 11:57
39

you may try:

docker-machine create -d virtualbox default

UPDATE 2016/10/19

The old answer may only work on mac with virtualbox installed.

If you are running docker-machine on windows, you should use Hyper-V :

docker-machine create --driver hyperv vm

see detail here:https://docs.docker.com/machine/drivers/hyper-v/

And if you are using Docker Machine to provision hosts on cloud providers, you may need other driver such as amazonec2 . More detail:https://docs.docker.com/machine/get-started-cloud/

Dai Kaixian
  • 1,045
  • 2
  • 14
  • 24
  • 4
    Please edit with more information. Code-only and "try this" answers are discouraged, because they contain no searchable content, and don't explain why someone should "try this". – abarisone Jul 27 '16 at 06:48
  • 1
    Sorry, I got it. And wil do better nexttime. – Dai Kaixian Aug 01 '16 at 01:40
  • 2
    First tried Docker for Mac -- no go. Tried this after so many other options and thanks! – cnp Sep 15 '16 at 03:20
  • I have ubuntu 14.04 I fire above command get following error "Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path" – Rajnik Sep 27 '16 at 12:12
  • @Rajnik yeah. I use docker-machine on my mac . I am not sure why you are using it on ubuntu . see here:https://docs.docker.com/machine/overview/ And if you really want to run it on ubuntu , you may need to get VirtualBox installed. – Dai Kaixian Sep 29 '16 at 01:25
  • For Windows 10 users, make sure when executing that you're console / powershell is started as an Administrator. – PGP_Protector May 02 '17 at 15:21
  • 1
    Not "only work on mac" for sure - it worked on Ubuntu with VirtualBox installed. Thanks. – kcpr May 27 '17 at 01:13
2

In case you run

docker-machine ls

and it lists default but running docker-machine kill default and docker-machine stop default both complain that it doesn't exist, try to remove it completely and setup again:

docker-machine rm default
docker-machine create default

(had this weird issue on Windows with virtualbox)

LihO
  • 41,190
  • 11
  • 99
  • 167
0

Sometimes, docker-machine start default might misbehave and require you to rerun the command again. In that case, running eval "$(docker-machine env default)" will bring back joy :)

Harrison Kamau
  • 324
  • 1
  • 5