docker 学习系列(一)--docker-machine

先讲解一下如何创建一个machine

1. 打开命令行

2. 使用 docker-machine ls 命令,默认情况下如下

 $ docker-machine ls
 NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS

 3. 创建一个machine

  • 如果你使用mac,不支持Hyper-V的windows上使用toolbox或者是docker for mac 需要使用virtualbox作为驱动。
  • 如果使用docker for windows可以使用如下方式创建

选择一个machine之后,选择虚拟机交换管理器

之后创建外部网络

 

点击确定

 这样就可以创建machine了        

  docker-machine create -d hyperv --hyperv-virtual-switch "<NameOfVirtualSwitch>" <nameOfNode>

下面是示例:

```shell
PS C:\WINDOWS\system32>  docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" default
Running pre-create checks...
Creating machine...
(manager1) Copying C:\Users\Vicky\.docker\machine\cache\boot2docker.iso to C:\Users\Vicky\.docker\machine\machines\manag
er1\boot2docker.iso...
(manager1) Creating SSH key...
(manager1) Creating VM...
(manager1) Using switch "Primary Virtual Switch"
(manager1) Creating VHD
(manager1) Starting VM...
(manager1) Waiting for host to start...
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: C:\Program Files\Doc
ker\Docker\Resources\bin\docker-machine.exe env manager1
PS C:\WINDOWS\system32>
```

 但是笔者电脑出现了一个 

Error creating machine: Error in driver during machine creation: exit status 1

经过几次尝试怀疑为内存不足,通过更改最小启动内存解决问题。

C:\WINDOWS\system32>docker-machine create -d hyperv --hyperv-virtual-switch "primary Virtual switch" default
Running pre-create checks...
(default) Image cache directory does not exist, creating it at C:\Users\LiangWentao\.docker\machine\cache...
(default) No default Boot2Docker ISO found locally, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v1.12.3
                                              (default) Downloading C:\Users\LiangWentao\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v1.12.3/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying C:\Users\LiangWentao\.docker\machine\cache\boot2docker.iso to C:\Users\LiangWentao\.docker\machine\machines\default\boot2docker.iso...
(default) Creating SSH key...
(default) Creating VM...
(default) Using switch "primary Virtual switch"
(default) Creating VHD
(default) Starting VM...
Error creating machine: Error in driver during machine creation: exit status 1

转载于:https://my.oschina.net/liangwt/blog/779441

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值