macbook 安装docker machine
安装步骤
# 安装docker-machine
base=https://github.com/docker/machine/releases/download/v0.16.2 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
# 安装一个docker-machine虚拟机
docker-machine create --driver=vmware default
# 安装过程中可能会出现如下错误
Running pre-create checks...
(default1) Boot2Docker URL was explicitly set to "https://github.com/boot2docker/boot2docker/releases/download/v18.04.0-ce-rc2/boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.
Creating machine...
(default1) Boot2Docker URL was explicitly set to "https://github.com/boot2docker/boot2docker/releases/download/v18.04.0-ce-rc2/boot2docker.iso" at create time, so Docker Machine cannot upgrade this machine to the latest version.
(default1) Downloading /Users/kamil/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.04.0-ce-rc2/boot2docker.iso...
(default1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(default1) Creating SSH key...
(default1) Creating VM...
(default1) Creating disk '/Users/kamil/.docker/machine/machines/default1/default1.vmdk'
(default1) Virtual disk creation successful.
(default1) Starting default1...
(default1) Waiting for VM to come online...
Error creating machine: Error in driver during machine creation: exit status 255
# 上面的报错提示是缺少vmware的插件导致的,解决方案如下
# 第一种,brew安装
brew install docker-machine-driver-vmware
# 第二种,源码安装, 需要先安装go
go get -u github.com/machine-drivers/docker-machine-driver-vmware
# 再次执行创建镜像命令
docker-machine create --driver=vmware default
Running pre-create checks...
Creating machine...
(default) Copying /Users/x x/.docker/machine/cache/boot2docker.iso to /Users/xx/.docker/machine/machines/default/boot2docker.iso...
(default) Creating SSH key...
(default) Creating VM...
(default) Starting default...
(default) Waiting for VM to come online...
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 default
# 出现上面提示说明安装成功
# 进入容器
docker-machine ssh [容器名称]
# 退出容器
exit
# 查看docker-machine命令,可以用如下命令
docker-machine --help
tips: docker machine 在最新版本已被弃用,用docker desktop替代
参考链接