（十四）Docker Machine基本使用

虫师 创建于 9 个月 之前

最后更新时间 2018-12-12

这一小节演示Machine的基本使用。

以 macOS 系统为例：

创建一个machine

指令：

$ docker-machine create --driver virtualbox my-machine
Creating CA: /Users/fnngj/.docker/machine/certs/ca.pem
Creating client certificate: /Users/fnngj/.docker/machine/certs/cert.pem
Running pre-create checks...
Creating machine...
(my-machine) Copying /Users/fnngj/.docker/machine/cache/boot2docker.iso to /Users/fnngj/.docker/machine/machines/my-machine/boot2docker.iso...
(my-machine) Creating VirtualBox VM...
(my-machine) Creating SSH key...
(my-machine) Starting the VM...
(my-machine) Check network to re-create if needed...
(my-machine) Found a new host-only adapter: "vboxnet0"
(my-machine) Waiting for an IP...
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 boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env my-machine