问题
$ docker-machine create --driver virtualbox servm-1
Creating CA: /Users/username/.docker/machine/certs/ca.pem
Creating client certificate: /Users/username/.docker/machine/certs/cert.pem
Running pre-create checks...
(servm-1) Image cache directory does not exist, creating it at /Users/username/.docker/machine/cache...
(servm-1) No default Boot2Docker ISO found locally, downloading the latest release...
Error with pre-create check: "failure getting a version tag from the Github API response (are you getting rate limited by Github?)"
解决方案
我们可以google找到相应的解决方案Solution
# If seeing:
# (dev) No default Boot2Docker ISO found locally, downloading the latest release...
# Error with pre-create check: "failure getting a version tag from the Github API response (are you getting rate limited by Github?)"
# then:
curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v1.9.1/boot2docker.iso
创建docker-machine
$ curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v1.9.1/boot2docker.iso
$ docker-machine create --driver virtualbox servm-1
Running pre-create checks...
(servm-1) Unable to get the latest Boot2Docker ISO release version: failure getting a version tag from the Github API response (are you getting rate limited by Github?)
Creating machine...
(servm-1) Unable to get the latest Boot2Docker ISO release version: failure getting a version tag from the Github API response (are you getting rate limited by Github?)
(servm-1) Copying /Users/username/.docker/machine/cache/boot2docker.iso to /Users/username/.docker/machine/machines/servm-1/boot2docker.iso...
(servm-1) Creating VirtualBox VM...
(servm-1) Creating SSH key...
(servm-1) Starting the VM...
(servm-1) Check network to re-create if needed...
(servm-1) Found a new host-only adapter: "vboxnet1"
(servm-1) 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 servm-1
新的问题
但是,当我们执行swarm
时,仍然有问题
$ docker-machine ssh servm-1 "docker swarm init --advertise-addr 192.168.99.100"
Google出来的结果是Docker版本过低,还不能够swarm
,我可是最新版本啊😂😂😂!
于是,我ssh进去,版本还真是低!!!居然是2015年的,我的天。
$ docker-machine ssh servm-1
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.9.1, build master : cef800b - Fri Nov 20 19:33:59 UTC 2015
Docker version 1.9.1, build a34a1d5
此时发现,https://github.com/boot2docker/.../v1.9.1/boot2docker.iso,还真是1.9.1版本。
于是,下载了最新版本的boot2docker,并替换~/.docker/machine/cache/boot2docker.iso
。
重新创建
$ docker-machine rm servm-1
About to remove servm-1
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Successfully removed servm-1
$ docker-machine create --driver virtualbox servm-1
... ...
$ docker-machine ssh servm-1 "docker swarm init --advertise-addr 192.168.99.102"
Swarm initialized: current node (nha5c34sqeptxxej52fezljkf) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-07kfvclhdq6rqpgjomjcsmfcjd8l9q576ety8tuzetbscyxfhk-5rvcpmvto7zz0bswjixlzbjb7 192.168.99.102:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.