Docker-Placement constraints

Posted 一路追寻

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker-Placement constraints相关的知识,希望对你有一定的参考价值。

Placement constraints

Use placement constraints to control the nodes a service can be assigned to. In the following example, the service only runs on nodes with the label region set to east. If no appropriately-labelled nodes are available, tasks will wait in Pending until they become available. The --constraint flag uses an equality operator (== or !=). For replicated services, it is possible that all services run on the same node, or each node only runs one replica, or that some nodes don’t run any replicas. For global services, the service runs on every node that meets the placement constraint and any resource requirements.

$ docker service create \\
  --name my-nginx \\
  --replicas 5 \\
  --constraint node.labels.region==east \\
  nginx

You can also use the constraint service-level key in a docker-compose.yml file.

If you specify multiple placement constraints, the service only deploys onto nodes where they are all met. The following example limits the service to run on all nodes where region is set to east and type is not set to devel:

$ docker service create \\
  --name my-nginx \\
  --mode global \\
  --constraint node.labels.region==east \\
  --constraint node.labels.type!=devel \\
  nginx

You can also use placement constraints in conjunction with placement preferences and CPU/memory constraints. Be careful not to use settings that are not possible to fulfill.

For more information on constraints, refer to the docker service create CLI reference

Deploy services to a swarm | Docker Documentation

以上是关于Docker-Placement constraints的主要内容,如果未能解决你的问题,请参考以下文章

Docker-Placement constraints

Error:(27, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2约束布局constrai

gatsby-image-plugin,StaticImage 不能覆盖默认的包装样式(gatsby-image-wrapper & gatsby-image-wrapper-constrai

Android ConstraintLayout

oracle数据库维护操作4

Hibernate Validator注解大全