Fix rendering of code block for swarm tutorial (#1370)

Indentations are added to fix rendering failure.
This commit is contained in:
C.X. Ling 2017-01-26 03:01:00 +08:00 committed by John Mulhausen
parent 3ff3b7cf42
commit 49a333885d
7 changed files with 81 additions and 79 deletions

View File

@ -7,11 +7,12 @@ title: Add nodes to the swarm
Once you've [created a swarm](create-swarm.md) with a manager node, you're ready
to add worker nodes.
1. Open a terminal and ssh into the machine where you want to run a worker node.
This tutorial uses the name `worker1`.
1. Open a terminal and ssh into the machine where you want to run a worker node.
This tutorial uses the name `worker1`.
2. Run the command produced by the `docker swarm init` output from the
[Create a swarm](create-swarm.md) tutorial step to create a worker node joined to the existing swarm:
2. Run the command produced by the `docker swarm init` output from the
[Create a swarm](create-swarm.md) tutorial step to create a worker node
joined to the existing swarm:
```bash
$ docker swarm join \
@ -34,12 +35,12 @@ This tutorial uses the name `worker1`.
192.168.99.100:2377
```
3. Open a terminal and ssh into the machine where you want to run a second
worker node. This tutorial uses the name `worker2`.
3. Open a terminal and ssh into the machine where you want to run a second
worker node. This tutorial uses the name `worker2`.
4. Run the command produced by the `docker swarm init` output from the
[Create a swarm](create-swarm.md) tutorial step to create a second worker node
joined to the existing swarm:
4. Run the command produced by the `docker swarm init` output from the
[Create a swarm](create-swarm.md) tutorial step to create a second worker
node joined to the existing swarm:
```bash
$ docker swarm join \
@ -49,8 +50,8 @@ joined to the existing swarm:
This node joined a swarm as a worker.
```
5. Open a terminal and ssh into the machine where the manager node runs and run
the `docker node ls` command to see the worker nodes:
5. Open a terminal and ssh into the machine where the manager node runs and
run the `docker node ls` command to see the worker nodes:
```bash
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS

View File

@ -7,22 +7,23 @@ title: Delete the service running on the swarm
The remaining steps in the tutorial don't use the `helloworld` service, so now
you can delete the service from the swarm.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
2. Run `docker service rm helloworld` to remove the `helloworld` service.
2. Run `docker service rm helloworld` to remove the `helloworld` service.
```
```bash
$ docker service rm helloworld
helloworld
```
3. Run `docker service inspect <SERVICE-ID>` to verify that the swarm manager
removed the service. The CLI returns a message that the service is not found:
3. Run `docker service inspect <SERVICE-ID>` to verify that the swarm manager
removed the service. The CLI returns a message that the service is not
found:
```
```bash
$ docker service inspect helloworld
[]
Error: no such service: helloworld

View File

@ -8,8 +8,8 @@ After you [create a swarm](create-swarm.md), you can deploy a service to the
swarm. For this tutorial, you also [added worker nodes](add-nodes.md), but that
is not a requirement to deploy a service.
1. Open a terminal and ssh into the machine where you run your manager node. For
example, the tutorial uses a machine named `manager1`.
1. Open a terminal and ssh into the machine where you run your manager node.
For example, the tutorial uses a machine named `manager1`.
2. Run the following command:
@ -25,9 +25,9 @@ example, the tutorial uses a machine named `manager1`.
* The arguments `alpine ping docker.com` define the service as an Alpine
Linux container that executes the command `ping docker.com`.
3. Run `docker service ls` to see the list of running services:
3. Run `docker service ls` to see the list of running services:
```
```bash
$ docker service ls
ID NAME SCALE IMAGE COMMAND

View File

@ -13,11 +13,11 @@ availability. `DRAIN` availability prevents a node from receiving new tasks
from the swarm manager. It also means the manager stops tasks running on the
node and launches replica tasks on a node with `ACTIVE` availability.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
2. Verify that all your nodes are actively available.
2. Verify that all your nodes are actively available.
```bash
$ docker node ls
@ -28,7 +28,7 @@ run your manager node. For example, the tutorial uses a machine named
e216jshn25ckzbvmwlnh5jr3g * manager1 Ready Active Leader
```
3. If you aren't still running the `redis` service from the [rolling
3. If you aren't still running the `redis` service from the [rolling
update](rolling-update.md) tutorial, start it now:
```bash
@ -37,7 +37,7 @@ update](rolling-update.md) tutorial, start it now:
c5uo6kdmzpon37mgj9mwglcfw
```
4. Run `docker service ps redis` to see how the swarm manager assigned the
4. Run `docker service ps redis` to see how the swarm manager assigned the
tasks to different nodes:
```bash
@ -52,7 +52,7 @@ tasks to different nodes:
In this case the swarm manager distributed one task to each node. You may
see the tasks distributed differently among the nodes in your environment.
5. Run `docker node update --availability drain <NODE-ID>` to drain a node that
5. Run `docker node update --availability drain <NODE-ID>` to drain a node that
had a task assigned to it:
```bash
@ -61,7 +61,7 @@ had a task assigned to it:
worker1
```
6. Inspect the node to check its availability:
6. Inspect the node to check its availability:
```bash
$ docker node inspect --pretty worker1
@ -76,7 +76,7 @@ had a task assigned to it:
The drained node shows `Drain` for `AVAILABILITY`.
7. Run `docker service ps redis` to see how the swarm manager updated the
7. Run `docker service ps redis` to see how the swarm manager updated the
task assignments for the `redis` service:
```bash
@ -93,7 +93,7 @@ task assignments for the `redis` service:
with `Drain` availability and creating a new task on a node with `Active`
availability.
8. Run `docker node update --availability active <NODE-ID>` to return the
8. Run `docker node update --availability active <NODE-ID>` to return the
drained node to an active state:
```bash
@ -102,22 +102,22 @@ drained node to an active state:
worker1
```
9. Inspect the node to see the updated state:
9. Inspect the node to see the updated state:
```bash
$ docker node inspect --pretty worker1
```bash
$ docker node inspect --pretty worker1
ID: 38ciaotwjuritcdtn9npbnkuz
Hostname: worker1
Status:
State: Ready
Availability: Active
...snip...
```
ID: 38ciaotwjuritcdtn9npbnkuz
Hostname: worker1
Status:
State: Ready
Availability: Active
...snip...
```
When you set the node back to `Active` availability, it can receive new tasks:
When you set the node back to `Active` availability, it can receive new tasks:
* during a service update to scale up
* during a rolling update
* when you set another node to `Drain` availability
* when a task fails on another active node
* during a service update to scale up
* during a rolling update
* when you set another node to `Drain` availability
* when a task fails on another active node

View File

@ -7,16 +7,16 @@ title: Inspect a service on the swarm
When you have [deployed a service](deploy-service.md) to your swarm, you can use
the Docker CLI to see details about the service running in the swarm.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
2. Run `docker service inspect --pretty <SERVICE-ID>` to display the details
about a service in an easily readable format.
2. Run `docker service inspect --pretty <SERVICE-ID>` to display the details
about a service in an easily readable format.
To see the details on the `helloworld` service:
```
```bash
$ docker service inspect --pretty helloworld
ID: 9uk4639qpg7npwf3fn2aasksr
@ -36,7 +36,7 @@ about a service in an easily readable format.
>**Tip**: To return the service details in json format, run the same command
without the `--pretty` flag.
```
```bash
$ docker service inspect helloworld
[
{
@ -85,10 +85,10 @@ about a service in an easily readable format.
]
```
4. Run `docker service ps <SERVICE-ID>` to see which nodes are running the
service:
4. Run `docker service ps <SERVICE-ID>` to see which nodes are running the
service:
```
```bash
$ docker service ps helloworld
NAME IMAGE NODE DESIRED STATE LAST STATE
@ -103,8 +103,8 @@ service:
task so you can see if tasks are running according to the service
definition.
4. Run `docker ps` on the node where the task is running to see details about
the container for the task.
4. Run `docker ps` on the node where the task is running to see details about
the container for the task.
>**Tip**: If `helloworld` is running on a node other than your manager node,
you must ssh to that node.

View File

@ -9,12 +9,12 @@ instances of a service. In this part of the tutorial, you deploy a service based
on the Redis 3.0.6 container image. Then you upgrade the service to use the
Redis 3.0.7 container image using rolling updates.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
2. Deploy Redis 3.0.6 to the swarm and configure the swarm with a 10 second
update delay:
2. Deploy Redis 3.0.6 to the swarm and configure the swarm with a 10 second
update delay:
```bash
$ docker service create \
@ -44,7 +44,7 @@ update delay:
`--update-failure-action` flag for `docker service create` or
`docker service update`.
3. Inspect the `redis` service:
3. Inspect the `redis` service:
```bash
$ docker service inspect --pretty redis
@ -64,7 +64,7 @@ update delay:
Endpoint Mode: vip
```
4. Now you can update the container image for `redis`. The swarm manager
4. Now you can update the container image for `redis`. The swarm manager
applies the update to nodes according to the `UpdateConfig` policy:
```bash
@ -82,7 +82,7 @@ applies the update to nodes according to the `UpdateConfig` policy:
* If, at any time during the update, a task returns `FAILED`, pause the
update.
5. Run `docker service inspect --pretty redis` to see the new image in the
5. Run `docker service inspect --pretty redis` to see the new image in the
desired state:
```bash
@ -127,7 +127,7 @@ desired state:
To avoid repeating certain update failures, you may need to reconfigure the
service by passing flags to `docker service update`.
6. Run `docker service ps <SERVICE-ID>` to watch the rolling update:
6. Run `docker service ps <SERVICE-ID>` to watch the rolling update:
```bash
$ docker service ps redis

View File

@ -8,12 +8,12 @@ Once you have [deployed a service](deploy-service.md) to a swarm, you are ready
to use the Docker CLI to scale the number of service ps in
the swarm.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
1. If you haven't already, open a terminal and ssh into the machine where you
run your manager node. For example, the tutorial uses a machine named
`manager1`.
2. Run the following command to change the desired state of the
service running in the swarm:
2. Run the following command to change the desired state of the
service running in the swarm:
```bash
$ docker service scale <SERVICE-ID>=<NUMBER-OF-TASKS>
@ -27,9 +27,9 @@ service running in the swarm:
helloworld scaled to 5
```
3. Run `docker service ps <SERVICE-ID>` to see the updated task list:
3. Run `docker service ps <SERVICE-ID>` to see the updated task list:
```
```bash
$ docker service ps helloworld
NAME IMAGE NODE DESIRED STATE CURRENT STATE
@ -44,10 +44,10 @@ service running in the swarm:
running instances of Alpine Linux. The tasks are distributed between the
three nodes of the swarm. One is running on `manager1`.
4. Run `docker ps` to see the containers running on the node where you're
connected. The following example shows the tasks running on `manager1`:
4. Run `docker ps` to see the containers running on the node where you're
connected. The following example shows the tasks running on `manager1`:
```
```bash
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES