Docker Toolbox

Docker Toolbox 使用指南

Docker Toolbox 是适配老操作系统的 Docker 环境,依赖例如:Hyper-V、VirtualBox 之类的虚拟机支持。

安装

Windows

# 从 Amazon S3 下载安装包,按需加代理提速
choco install -y docker-toolbox  --proxy "http://192.168.1.111:8118"

macOS

brew cask install docker-toolbox

下载

常用命令

虚拟机巡查

命令 作用
docker-machine ls 罗列所有虚机
docker-machine env VM_NAME 获取连接 Docker 服务器所需环境变量
eval $(docker-machine env VM_NAME) 设置环境变量连接 Docker 服务器
docker-machine ip VM_NAME
docker-machine ssh VM_NAME 连接到指定虚机的 Console

虚拟机管理

命令 作用
docker-machine create VM_NAME --driver hyperv 用 Hyper-V 新建虚机
docker-machine create VM_NAME --driver virtualbox 用 VirtualBox 新建虚机
docker-machine start VM_NAME 启动虚机
docker-machine ssh VM_NAME 远程登录虚拟机
docker-machine env VM_NAME 获取连接 Docker 服务器所需环境变量

疑难杂症

创建虚机不返回

(default) Creating VM...
(default) Using switch "External Virtual Switch"
(default) Creating VHD
(default) Starting VM...
(default) Waiting for host to start...
Waiting for machine to be running, this may take a few minutes...

解决方案

用 Hyper-V 创建虚机时,确认 Virtual Switch Manager 的 External Virtual Switch 绑定的网卡可用。选择使用中的网卡保存后,虚机创建过程即可顺利完成。

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!
Author: njun
njun's picture
Updated: 2020/04/15