• Docker Machine, Compose, and Swarm: How They Work Together


    The three tools are now neatly packaged into what’s called the Docker Toolbox.

    Docker Machine
    1/ create Linux VM
    docker-machine create --driver virtualbox containerhost
    or
    docker-machine create -d virtualbox local
    2/ open docker vm's interface
    eval "$(docker-machine env local)"
    or
    boot2docker shellinit

    3/ stop vm
    docker-machine stop containerhost
    4/ remove vm
    docker-machine rm containerhost

    Docker Compose
    1/ compose docker-compose.yml in repository directory
    2/ docker-compose up

    Docker Swarm
    1/ generate “discovery token”(in vm)
    docker run swarm create
    # The discovery token is actually created using Docker’s public discovery service.

    2/ create Swarm Master(in host machine)
    docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://YOURTOKENHERE swarm-master

    3/ create Swarm nodes(in host machine)
    docker-machine create -d virtualbox --swarm --swarm-discovery token://YOURTOKENHERE swarm-agent-00
    docker-machine create -d virtualbox --swarm --swarm-discovery token://YOURTOKENHERE swarm-agent-01

    4/ shut down and remove 'local'

    5/ open Swarm Master shell
    eval $(docker-machine env --swarm swarm-master)
    # Now we have a Swarm Master and two Swarm Nodes running locally,use 'docker info' to check

    6/ run containers on cluster node
    docker run -d redis
    # 0d7af2492be35cc9c7593f6d677185c6c44f3a06898258585c7d2d2f9aa03c2e
    docker run -d nginx
    # 0babf055abf9b487b6bafd4651386075f8d6f46ce9f192849bc32345997438ea

    7/ list the containers scheduled on different clustered
    docker ps

  • 相关阅读:
    我cnblogs的主题
    Scala Error: error while loading Suite, Scala signature Suite has wrong version expected: 5.0 found: 4.1 in Suite.class
    Spark之路 --- Scala用JFreeChart画图表实例
    Spark之路 --- Scala IDE Maven配置(使用开源中国的Maven库)和使用
    Spark之路 --- Windows Scala 开发环境安装配置
    epoll函数
    Linux网络编程目录
    函数wait和waitpid
    会话
    进程组
  • 原文地址:https://www.cnblogs.com/dadream/p/5029754.html
Copyright © 2020-2023  润新知