安装Docker Machine

什么是Docker Machine

Docker Machine是Docker官方编排项目之一,由Go语言实现,负责在多种平台上快速安装Docker环境,Github项目主页

它支持Linux、MacOS、Windows,在Mac/Windows的Docker Desktop版本中自带docker-machine二进制包,直接就能使用

现在Docker Machine项目已经被移到被替换的产品和工具栏了,写这篇文章,主要是为了写Docker Swarm时创建几个虚拟机方便点 ??

Linux安装Docker Machine

从官方仓库Release直接下载二进制文件复制到PATH能找到的目录下,再给个x权限就好

$ curl -L https://github.com/docker/machine/releases/download/v0.16.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine &&
    chmod +x /tmp/docker-machine &&
    sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

查看版本号

$ docker-machine -v

docker-machine version 0.16.2, build bd45ab13

基本命令help

这里直接粘出来help文档吧,只为了简单用用

$ docker-machine --help
Usage: docker-machine [OPTIONS] COMMAND [arg...]

Create and manage machines running Docker.

Version: 0.16.2, build bd45ab13

Author:
  Docker Machine Contributors - <https://github.com/docker/machine>

Options:
  --debug, -D                       Enable debug mode
  --storage-path, -s "/home/hellxz/.docker/machine" Configures storage path [$MACHINE_STORAGE_PATH]
  --tls-ca-cert                     CA to verify remotes against [$MACHINE_TLS_CA_CERT]
  --tls-ca-key                      Private key to generate certificates [$MACHINE_TLS_CA_KEY]
  --tls-client-cert                     Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
  --tls-client-key                  Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
  --github-api-token                    Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN]
  --native-ssh                      Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
  --bugsnag-api-token                   BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN]
  --help, -h                        show help
  --version, -v                     print the version
  
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

相关推荐