Affinity labels like -e affinity:com.example.type==test#667
Affinity labels like -e affinity:com.example.type==test#667aluzzardi merged 6 commits intodocker-archive:masterfrom vieux:affinity_labels
-e affinity:com.example.type==test#667Conversation
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
|
ping @aluzzardi @abronan |
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
|
LGTM |
|
@moxiegirl can you please take a quick look at the doc ? Thank you |
scheduler/filter/README.md
Outdated
There was a problem hiding this comment.
Doc feedback - how about:
You can force containers to be co-scheduled on the same node as another container by specifying its name or ID.
/cc @moxiegirl
|
Minor comments. Overall LGTM |
|
Looking at this now...I'll give feedback shortly. |
|
@vieux I noticed several things in the current text.
---> https://gist.github.com/moxiegirl/7b1801dacd71c8eb80be Affinity filterYou use an Container affinityYou can schedule a new container to run next to another based on a container $ docker run -d -p 80:80 --name front nginx
87c4376856a8
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES
87c4376856a8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:80->80/tcp node-1 frontThen, using $ docker run -d --name logger -e affinity:container==front logger
87c4376856a8
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES
87c4376856a8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:80->80/tcp node-1 front
963841b138d8 logger:latest "logger" Less than a second ago running node-1 loggerBecause of name affinity, the docker run -d --name logger -e affinity:container==87c4376856a8`Image affinityYou can schedule a container to run only on nodes where a specific image is already pulled. $ docker -H node-1:2375 pull redis
$ docker -H node-2:2375 pull mysql
$ docker -H node-3:2375 pull redisOnly $ docker run -d --name redis1 -e affinity:image==redis redis
$ docker run -d --name redis2 -e affinity:image==redis redis
$ docker run -d --name redis3 -e affinity:image==redis redis
$ docker run -d --name redis4 -e affinity:image==redis redis
$ docker run -d --name redis5 -e affinity:image==redis redis
$ docker run -d --name redis6 -e affinity:image==redis redis
$ docker run -d --name redis7 -e affinity:image==redis redis
$ docker run -d --name redis8 -e affinity:image==redis redis
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES
87c4376856a8 redis:latest "redis" Less than a second ago running node-1 redis1
1212386856a8 redis:latest "redis" Less than a second ago running node-1 redis2
87c4376639a8 redis:latest "redis" Less than a second ago running node-3 redis3
1234376856a8 redis:latest "redis" Less than a second ago running node-1 redis4
86c2136253a8 redis:latest "redis" Less than a second ago running node-3 redis5
87c3236856a8 redis:latest "redis" Less than a second ago running node-3 redis6
87c4376856a8 redis:latest "redis" Less than a second ago running node-3 redis7
963841b138d8 redis:latest "redis" Less than a second ago running node-1 redis8As you can see here, the containers were only scheduled on nodes that had the $ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
redis latest 06a1f75304ba 2 days ago 111.1 MB
$ docker run -d --name redis1 -e affinity:image==06a1f75304ba redisLabel affinityLabel affinity allows you to set up an attraction based on a container's label. $ docker run -d -p 80:80 --label com.example.type=front nginx
87c4376856a8
$ docker ps --filter "label=com.example.type=front"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES
87c4376856a8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:80->80/tcp node-1 trusting_yonathThen, use $ docker run -d -e affinity:com.example.type==front logger
87c4376856a8
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES
87c4376856a8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:80->80/tcp node-1 trusting_yonath
963841b138d8 logger:latest "logger" Less than a second ago running node-1 happy_hawkingThe |
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
|
@aluzzardi @moxiegirl can you please take one last look, I believe it's good to merge |
|
LGTM |
Affinity labels like `-e affinity:com.example.type==test`
No description provided.