zoukankan      html  css  js  c++  java
  • docker swarm 过滤器affinity 限制副本不会出现在同一个节点上

          affinity:container!=容器服务名称(可以是正则)

    举个例子:stack_ds.yaml

    # cat stack_dsc.yaml 
    version: '3.0'
    services:
       test:
        image: xxxxxxxxx
        logging:
          driver: "json-file"
          options:
            max-size: "50m"
            max-file: "10"
        environment:
          - MYSQL_HOST=192.168.
          - MYSQL_DATABASE=dsc
          - MYSQL_USERNAME=u_dsc
          - MYSQL_PORT=3306
          - MYSQL_PASSWORD=xxxx
          - "affinity:container!=test"
        deploy:
          mode: replicated
          replicas: 3
          restart_policy:
            condition: on-failure
          resources:
            limits:
              memory: 1048m
        networks:
          - basenet
    networks:
      basenet:
        external: true
    "affinity:container!=test"
    节点上若有test的容器,则不在该节点启动。
    若节点小于3,则忽略上一条规则
  • 相关阅读:
    Stone Game, Why are you always there? HDU
    SG函数
    A New Stone Game POJ
    卡特兰数
    找单词 HDU
    排列组合 HDU
    Harry And Magic Box HDU
    GCD and LCM HDU
    Co-prime HDU
    线段树——F
  • 原文地址:https://www.cnblogs.com/zoujiaojiao/p/10893834.html
Copyright © 2011-2022 走看看