From b0653fa4734a7b8542fc753cc5868751dd9a0111 Mon Sep 17 00:00:00 2001 From: Chang Long Xu Date: Thu, 10 Dec 2015 09:16:12 +0800 Subject: [PATCH] recommit Signed-off-by: Chang Long Xu --- docs/scheduler/filter.md | 76 +++++++++++++++++++------------------- docs/scheduler/strategy.md | 16 ++++---- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/docs/scheduler/filter.md b/docs/scheduler/filter.md index 56afc803e3..5cd0bd8f0c 100644 --- a/docs/scheduler/filter.md +++ b/docs/scheduler/filter.md @@ -104,10 +104,10 @@ container, you can use a `constraint` to ensure the database gets good I/O performance. You do this by by filter for nodes with flash drives: ```bash -$ docker run -d -P -e constraint:storage==ssd --name db mysql +$ docker tcp:// run -d -P -e constraint:storage==ssd --name db mysql f8b693db9cd6 -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES f8b693db9cd6 mysql:latest "mysqld" Less than a second ago running 192.168.0.42:49178->3306/tcp node-1 db ``` @@ -119,10 +119,10 @@ selected because it's the only host running flash. Suppose you want run an Nginx frontend in a cluster. In this case, you wouldn't want flash drives because the frontend mostly writes logs to disk. ```bash -$ docker run -d -P -e constraint:storage==disk --name frontend nginx +$ docker tcp:// run -d -P -e constraint:storage==disk --name frontend nginx 963841b138d8 -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES 963841b138d8 nginx:latest "nginx" Less than a second ago running 192.168.0.43:49177->80/tcp node-2 frontend f8b693db9cd6 mysql:latest "mysqld" Up About a minute running 192.168.0.42:49178->3306/tcp node-1 db @@ -197,11 +197,11 @@ name or ID. For example, you can start a container called `frontend` running `nginx`: ```bash -$ docker run -d -p 80:80 --name frontend nginx +$ docker tcp:// run -d -p 80:80 --name frontend nginx 87c4376856a8 -$ docker ps +$ docker tcp:// 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 frontend ``` @@ -210,10 +210,10 @@ Then, using `-e affinity:container==frontend` value to schedule a second container to locate and run next to the container named `frontend`. ```bash -$ docker run -d --name logger -e affinity:container==frontend logger +$ docker tcp:// run -d --name logger -e affinity:container==frontend logger 87c4376856a8 -$ docker ps +$ docker tcp:// 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 frontend 963841b138d8 logger:latest "logger" Less than a second ago running node-1 logger @@ -224,7 +224,7 @@ with the `frontend` container. Instead of the `frontend` name you could have supplied its ID as follows: ```bash -$ docker run -d --name logger -e affinity:container==87c4376856a8 +$ docker tcp:// run -d --name logger -e affinity:container==87c4376856a8 ``` #### Example image affinity @@ -244,16 +244,16 @@ affinity:image==redis` filter to schedule several additional containers to run on these nodes. ```bash -$ 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 tcp:// run -d --name redis1 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis2 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis3 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis4 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis5 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis6 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis7 -e affinity:image==redis redis +$ docker tcp:// run -d --name redis8 -e affinity:image==redis redis -$ docker ps +$ docker tcp:// 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 @@ -273,7 +273,7 @@ $ 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 redis +$ docker tcp:// run -d --name redis1 -e affinity:image==06a1f75304ba redis ``` #### Example label affinity @@ -283,10 +283,10 @@ example, you can run a `nginx` container and apply the `com.example.type=frontend` custom label. ```bash -$ docker run -d -p 80:80 --label com.example.type=frontend nginx +$ docker tcp:// run -d -p 80:80 --label com.example.type=frontend nginx 87c4376856a8 -$ docker ps --filter "label=com.example.type=frontend" +$ docker tcp:// ps --filter "label=com.example.type=frontend" 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 ``` @@ -295,10 +295,10 @@ Then, use `-e affnity:com.example.type==frontend` to schedule a container next to the container with the `com.example.type==frontend` label. ```bash -$ docker run -d -e affinity:com.example.type==frontend logger +$ docker tcp:// run -d -e affinity:com.example.type==frontend logger 87c4376856a8 -$ docker ps +$ docker tcp:// 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_hawking @@ -339,10 +339,10 @@ By default, containers run on Docker's bridge network. To use the `port` filter with the bridge network, you run a container as follows. ```bash -$ docker run -d -p 80:80 nginx +$ docker tcp:// run -d -p 80:80 nginx 87c4376856a8 -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND PORTS NODE NAMES 87c4376856a8 nginx:latest "nginx" 192.168.0.42:80->80/tcp node-1 prickly_engelbart ``` @@ -353,10 +353,10 @@ that uses the host port `80` results in Swarm selecting a different node, because port `80` is already occupied on `node-1`: ```bash -$ docker run -d -p 80:80 nginx +$ docker tcp:// run -d -p 80:80 nginx 963841b138d8 -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND PORTS NODE NAMES 963841b138d8 nginx:latest "nginx" 192.168.0.43:80->80/tcp node-2 dreamy_turing 87c4376856a8 nginx:latest "nginx" 192.168.0.42:80->80/tcp node-1 prickly_engelbart @@ -366,10 +366,10 @@ Again, repeating the same command will result in the selection of `node-3`, since port `80` is neither available on `node-1` nor `node-2`: ```bash -$ docker run -d -p 80:80 nginx +$ docker tcp:// run -d -p 80:80 nginx 963841b138d8 -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND PORTS NODE NAMES f8b693db9cd6 nginx:latest "nginx" 192.168.0.44:80->80/tcp node-3 stoic_albattani 963841b138d8 nginx:latest "nginx" 192.168.0.43:80->80/tcp node-2 dreamy_turing @@ -380,7 +380,7 @@ Finally, Docker Swarm will refuse to run another container that requires port `80`, because it is not available on any node in the cluster: ```bash -$ docker run -d -p 80:80 nginx +$ docker tcp:// run -d -p 80:80 nginx 2014/10/29 00:33:20 Error response from daemon: no resources available to schedule container ``` @@ -396,11 +396,11 @@ choose an available node for a new container. For example, the following commands start `nginx` on 3-node cluster. ```bash -$ docker run -d --expose=80 --net=host nginx +$ docker tcp:// run -d --expose=80 --net=host nginx 640297cb29a7 -$ docker run -d --expose=80 --net=host nginx +$ docker tcp:// run -d --expose=80 --net=host nginx 7ecf562b1b3f -$ docker run -d --expose=80 --net=host nginx +$ docker tcp:// run -d --expose=80 --net=host nginx 09a92f582bc2 ``` @@ -408,7 +408,7 @@ Port binding information is not available through the `docker ps` command becaus all the nodes were started with the `host` network. ```bash -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 640297cb29a7 nginx:1 "nginx -g 'daemon of Less than a second ago Up 30 seconds box3/furious_heisenberg 7ecf562b1b3f nginx:1 "nginx -g 'daemon of Less than a second ago Up 28 seconds box2/ecstatic_meitner @@ -418,16 +418,16 @@ CONTAINER ID IMAGE COMMAND CREATED Swarm refuses the operation when trying to instantiate the 4th container. ```bash -$ docker run -d --expose=80 --net=host nginx +$ docker tcp:// run -d --expose=80 --net=host nginx FATA[0000] Error response from daemon: unable to find a node with port 80/tcp available in the Host mode ``` However, port binding to the different value, for example `81`, is still allowed. ```bash -$ docker run -d -p 81:80 nginx:latest +$ docker tcp:// run -d -p 81:80 nginx:latest 832f42819adc -$ docker ps +$ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 832f42819adc nginx:1 "nginx -g 'daemon of Less than a second ago Up Less than a second 443/tcp, 192.168.136.136:81->80/tcp box3/thirsty_hawking 640297cb29a7 nginx:1 "nginx -g 'daemon of 8 seconds ago Up About a minute box3/furious_heisenberg @@ -441,7 +441,7 @@ To apply a node `constraint` or container `affinity` filters you must set environment variables on the container using filter expressions, for example: ```bash -$ docker run -d --name redis1 -e affinity:image==~redis redis +$ docker tcp:// run -d --name redis1 -e affinity:image==~redis redis ``` Each expression must be in the form: diff --git a/docs/scheduler/strategy.md b/docs/scheduler/strategy.md index 6f369cd03e..2daf8109dc 100644 --- a/docs/scheduler/strategy.md +++ b/docs/scheduler/strategy.md @@ -57,20 +57,20 @@ have 2G of RAM, 2 CPUs, and neither node is running a container. Under this stra When you run a new container, the system chooses `node-1` at random from the swarm of two equally ranked nodes: - $ docker run -d -P -m 1G --name db mysql + $ docker tcp:// run -d -P -m 1G --name db mysql f8b693db9cd6 - $ docker ps + $ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES f8b693db9cd6 mysql:latest "mysqld" Less than a second ago running 192.168.0.42:49178->3306/tcp node-1 db Now, we start another container and ask for 1G of RAM again. - $ docker run -d -P -m 1G --name frontend nginx + $ docker tcp:// run -d -P -m 1G --name frontend nginx 963841b138d8 - $ docker ps + $ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES 963841b138d8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:49177->80/tcp node-2 frontend f8b693db9cd6 mysql:latest "mysqld" Up About a minute running 192.168.0.42:49178->3306/tcp node-1 db @@ -87,10 +87,10 @@ neither is running a container. Again, the nodes are equal. When you run a new container, the system chooses `node-1` at random from the swarm: - $ docker run -d -P -m 1G --name db mysql + $ docker tcp:// run -d -P -m 1G --name db mysql f8b693db9cd6 - $ docker ps + $ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES f8b693db9cd6 mysql:latest "mysqld" Less than a second ago running 192.168.0.42:49178->3306/tcp node-1 db @@ -98,10 +98,10 @@ container, the system chooses `node-1` at random from the swarm: Now, you start another container, asking for 1G of RAM again. - $ docker run -d -P -m 1G --name frontend nginx + $ docker tcp:// run -d -P -m 1G --name frontend nginx 963841b138d8 - $ docker ps + $ docker tcp:// ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NODE NAMES 963841b138d8 nginx:latest "nginx" Less than a second ago running 192.168.0.42:49177->80/tcp node-1 frontend f8b693db9cd6 mysql:latest "mysqld" Up About a minute running 192.168.0.42:49178->3306/tcp node-1 db