Docker service deployment across multi-hosts

Setup

  • Install Docker

    sudo apt install docker
    
  • Run Docker without sudo

    sudo groupadd docker
    sudo usermod -aG $USER
    
  • Configure VMs
    在virtualbox使多台ubuntu虚拟机位于同一局域网
    VirtualBox实现内外网络互访问的配置
    主机不能访问虚拟机中的web服务的解决方案

Deployment

  • Create Cluster

    # on manager node
    docker swarm init
    
    # on worker node
    # run "docker swarm join-token manager" to get $token and $IP
    # run below command on slave/worker node to join swarm
    docker swarm join --token $token $IP:2377
    
  • Create Network

    docker network create -d overlay 
    
  • Create Service

    docker service create --name  [--network ] --replicas  -p  
    
  • Rollout

    docker service update --replicas 
    
    docker service update --image  
    
    docker service update --update-delay  --update-parallelism 
    
  • Inspection

    docker service inspect --pretty s
    
  • Test

    curl docker:
    

你可能感兴趣的:(Docker service deployment across multi-hosts)