美文网首页
docker-machine

docker-machine

作者: azreas | 来源:发表于2016-06-17 16:54 被阅读0次

    docker-machine 是docker官方提供的docker管理工具。
    通过docker-machine可以轻松的做到:

    • 在Windows平台和MAC平台安装和运行docker
    • 搭建和管理多个docker 主机
    • 搭建swarm集群

    create

    通过docker-machine create命令可以创建一台docker主机。该命令需要--driver标记来指定所需要的驱动(VirtualBox, DigitalOcean, AWS,等等)。

    $ docker-machine create --driver virtualbox dev
    Creating CA: /home/username/.docker/machine/certs/ca.pem
    Creating client certificate: /home/username/.docker/machine/certs/cert.pem
    Image cache does not exist, creating it at /home/username/.docker/machine/cache...
    No default boot2docker iso found locally, downloading the latest release...
    Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.6.2/boot2docker.iso to /home/username/.docker/machine/cache/boot2docker.iso...
    Creating VirtualBox VM...
    Creating SSH key...
    Starting VirtualBox VM...
    Starting VM...
    To see how to connect Docker to this machine, run: docker-machine env dev
    

    创建参数

    docker-machine create 提供了一些参数可以在所有驱动类型下使用,通过修改这些参数,我们可以在很大程度上定制终端的配置过程。

       --driver, -d "none"                                                                                  创建所需驱动类型
       --engine-install-url "https://get.docker.com"                                                        定制docker-engine的安装链接 [$MACHINE_DOCKER_INSTALL_URL]
       --engine-opt [--engine-opt option --engine-opt option]                                               创建docker-engine 所需参数
       --engine-insecure-registry [--engine-insecure-registry option --engine-insecure-registry option]     指定不安全的仓库地址(没有使用TLS协议)
       --engine-registry-mirror [--engine-registry-mirror option --engine-registry-mirror option]           指定镜像仓库地址
       --engine-label [--engine-label option --engine-label option]                                         指定创建docker-engine 所用label
       --engine-storage-driver                                                                              指定docker-engine存储所用驱动
       --engine-env [--engine-env option --engine-env option]                                               指定docker-engine所需环境变量
       --swarm                                                                                              Configure Machine with Swarm
       --swarm-image "swarm:latest"                                                                         Specify Docker image to use for Swarm [$MACHINE_SWARM_IMAGE]
       --swarm-master                                                                                       Configure Machine to be a Swarm master
       --swarm-discovery                                                                                    Discovery service to use with Swarm
       --swarm-strategy "spread"                                                                            Define a default scheduling strategy for Swarm
       --swarm-opt [--swarm-opt option --swarm-opt option]                                                  Define arbitrary flags for swarm
       --swarm-host "tcp://0.0.0.0:3376"                                                                    ip/socket to listen on for Swarm master
       --swarm-addr                                                                                         addr to advertise for Swarm (default: detect and use the machine IP)
       --swarm-experimental                                                                                 Enable Swarm experimental features
    

    注意
    其中有些标志是相互关联的,如果使用docker-machine create 命令时设置了其中一个,其余的同样会被设置并使用默认值

    相关文章

      网友评论

          本文标题:docker-machine

          本文链接:https://www.haomeiwen.com/subject/aekvdttx.html