美文网首页
Docker Swarm 服务约束

Docker Swarm 服务约束

作者: Hello泽泽 | 来源:发表于2020-03-08 04:26 被阅读0次

    1.约束在管理节点

    placement:
      constraints:
        - node.role == manager
    

    写成一行也可以

    placement:
      constraints: [node.role == manager]
    

    2.约束在工作节点

    placement:
      constraints:
        - node.role == worker
    

    3.约束在指定节点

    placement:
      constraints:
        - node.hostname == GZ-SWARM-86
    

    4.约束在指定标签

    节点增加标签

    # app=linuxhub
    docker node update --label-add  app="linuxhub" GZ-SWARM-86
    
    placement:
      constraints:
        - node.labels.app == linuxhub
    

    相关文章

      网友评论

          本文标题:Docker Swarm 服务约束

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