1 docker-machine 是用来干嘛的?
Docker Machine 是一种可以让您在虚拟主机上安装 Docker 的工具,并可以使用 docker-machine 命令来管理主机。Docker Machine 管理的虚拟主机可以是机上的,也可以是云供应商,如阿里云,腾讯云,AWS,或 DigitalOcean。使用 docker-machine 命令,您可以启动,检查,停止和重新启动托管主机,也可以升级 Docker 客户端和守护程序,以及配置 Docker 客户端与您的主机进行通信。
通俗来讲就是一个管理docker 的管理控制端,和vmware 有点像,只是不同的是vmware管理的是虚拟机,docker-machine 管理的是docker 。
2 命令集
Commands:
active Print which machine is active
config Print the connection config for machine
create Create a machine
env Display the commands to set up the environment for the Docker client
inspect Inspect information about a machine
ip Get the IP address of a machine
kill Kill a machine
ls List machines
provision Re-provision existing machines
regenerate-certs Regenerate TLS Certificates for a machine
restart Restart a machine
rm Remove a machine
ssh Log into or run a command on a machine with SSH.
scp Copy files between machines
mount Mount or unmount a directory from a machine with SSHFS.
start Start a machine
status Get the status of a machine
stop Stop a machine
upgrade Upgrade a machine to the latest version of Docker
url Get the URL of a machine
version Show the Docker Machine version or a machine docker version
help Shows a list of commands or help for one command
3 常用命令
- 虚拟机查看命令
docker-machine ls
- 创建虚拟机
docker-machine create --driver virtualbox test
- 查看IP
docker-machine ip test
- 启动机器
docker-machine start test
- 停止机器
docker-machine stop test
- 连接机器
docker-machine ssh test
- 查看运行机器
docker-machine active