github.com/olljanat/moby@v1.13.1/docs/reference/commandline/service_scale.md (about)

     1  ---
     2  title: "service scale"
     3  description: "The service scale command description and usage"
     4  keywords: "service, scale"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # service scale
    17  
    18  ```markdown
    19  Usage:  docker service scale SERVICE=REPLICAS [SERVICE=REPLICAS...]
    20  
    21  Scale one or multiple replicated services
    22  
    23  Options:
    24        --help   Print usage
    25  ```
    26  
    27  ## Examples
    28  
    29  ### Scale a service
    30  
    31  The scale command enables you to scale one or more replicated services either up
    32  or down to the desired number of replicas. This command cannot be applied on
    33  services which are global mode. The command will return immediately, but the
    34  actual scaling of the service may take some time. To stop all replicas of a
    35  service while keeping the service active in the swarm you can set the scale to 0.
    36  
    37  For example, the following command scales the "frontend" service to 50 tasks.
    38  
    39  ```bash
    40  $ docker service scale frontend=50
    41  frontend scaled to 50
    42  ```
    43  
    44  The following command tries to scale a global service to 10 tasks and returns an error.
    45  
    46  ```
    47  $ docker service create --mode global --name backend backend:latest
    48  b4g08uwuairexjub6ome6usqh
    49  $ docker service scale backend=10
    50  backend: scale can only be used with replicated mode
    51  ```
    52  
    53  Directly afterwards, run `docker service ls`, to see the actual number of
    54  replicas.
    55  
    56  ```bash
    57  $ docker service ls --filter name=frontend
    58  
    59  ID            NAME      MODE        REPLICAS  IMAGE
    60  3pr5mlvu3fh9  frontend  replicated  15/50     nginx:alpine
    61  ```
    62  
    63  You can also scale a service using the [`docker service update`](service_update.md)
    64  command. The following commands are equivalent:
    65  
    66  ```bash
    67  $ docker service scale frontend=50
    68  $ docker service update --replicas=50 frontend
    69  ```
    70  
    71  ### Scale multiple services
    72  
    73  The `docker service scale` command allows you to set the desired number of
    74  tasks for multiple services at once. The following example scales both the
    75  backend and frontend services:
    76  
    77  ```bash
    78  $ docker service scale backend=3 frontend=5
    79  backend scaled to 3
    80  frontend scaled to 5
    81  
    82  $ docker service ls
    83  ID            NAME      MODE        REPLICAS  IMAGE
    84  3pr5mlvu3fh9  frontend  replicated  5/5       nginx:alpine
    85  74nzcxxjv6fq  backend   replicated  3/3       redis:3.0.6
    86  ```
    87  
    88  ## Related information
    89  
    90  * [service create](service_create.md)
    91  * [service inspect](service_inspect.md)
    92  * [service logs](service_logs.md)
    93  * [service ls](service_ls.md)
    94  * [service rm](service_rm.md)
    95  * [service ps](service_ps.md)
    96  * [service update](service_update.md)