How to run “docker-machine create” in OS X?

2019-03-15 08:41发布

I started Docker and am now following the tutorial, but for all I know I couldn't run the docker-machine command on OS X.

The documentation states that you run the following command to create a local virtual machine:

docker-machine create --driver virtualbox manager

However, this command doesn't work in OS X (11.6), with the following error:

Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"

I tried to install the virtualbox; however, another page clearly states that you must not install it on your local machine:

VirtualBox prior to version 4.3.30 must NOT be installed (it is incompatible with Docker for Mac)

Note: If your system does not satisfy these requirements, you can install Docker Toolbox, which uses Oracle VirtualBox instead of HyperKit.

So I only installed Docker for Mac and not virtualbox. So what am I missing here? The example page says you can run the tutorial on OS X, so I wonder how I can proceed...

You can follow along and run this example using Docker for Mac, Docker for Windows or Docker for Linux.

标签: macos docker
2条回答
地球回转人心会变
2楼-- · 2019-03-15 09:18

I had the same issue. At the same spot ;-) For me the xhyve driver, available from https://github.com/zchee/docker-machine-driver-xhyve, worked. In short:

brew install docker-machine-driver-xhyve

You get a notice some links need to be created manually, so copy those and execute

sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Create:

docker-machine create --driver xhyve manager

Without VirtualBox. Im using OS X 10.11.6, too.

查看更多
Fickle 薄情
3楼-- · 2019-03-15 09:32

I had the same issue today and resolved it by installing VirtualBox as an additional step after installing Docker for Mac (I did so with brew cask install virtualbox)

I don't recall having to do the extra install previously, but maybe I already had VirtualBox already installed because of another tool (like Vagrant). Anyway, this is explained in the Docker Machine documentation:

If you are using Docker for Mac

Docker for Mac uses HyperKit, a lightweight macOS virtualization solution built on top of the Hypervisor.framework in macOS 10.10 Yosemite and higher.

Currently, there is no docker-machine create driver for HyperKit, so you will use virtualbox driver to create local machines. (See the Docker Machine driver for Oracle VirtualBox.) Note that you can run both HyperKit and Oracle VirtualBox on the same system. To learn more, see Docker for Mac vs. Docker Toolbox.

  • Make sure you have the latest VirtualBox correctly installed on your system (either as part of an earlier Toolbox install, or manual install).
查看更多
登录 后发表回答