From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- ...ence%2Fcommandline%2Fservice_scale%2Findex.html | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html') diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html new file mode 100644 index 00000000..c3779db1 --- /dev/null +++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_scale%2Findex.html @@ -0,0 +1,35 @@ +

docker service scale


Scale one or multiple replicated services

Swarm This command works with the Swarm orchestrator.

Usage

$ docker service scale SERVICE=REPLICAS [SERVICE=REPLICAS...]
+

Refer to the options section for an overview of available OPTIONS for this command.

Description

The scale command enables you to scale one or more replicated services either up or down to the desired number of replicas. This command cannot be applied on services which are global mode. The command will return immediately, but the actual scaling of the service may take some time. To stop all replicas of a service while keeping the service active in the swarm you can set the scale to 0.

Note

This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the Swarm mode section in the documentation.

For example uses of this command, refer to the examples section below.

Options

Name, shorthand Default Description
+--detach , -d + Exit immediately instead of waiting for the service to converge

Examples

Scale a single service

The following command scales the “frontend” service to 50 tasks.

$ docker service scale frontend=50
+
+frontend scaled to 50
+

The following command tries to scale a global service to 10 tasks and returns an error.

$ docker service create --mode global --name backend backend:latest
+
+b4g08uwuairexjub6ome6usqh
+
+$ docker service scale backend=10
+
+backend: scale can only be used with replicated or replicated-job mode
+

Directly afterwards, run docker service ls, to see the actual number of replicas.

$ docker service ls --filter name=frontend
+
+ID            NAME      MODE        REPLICAS  IMAGE
+3pr5mlvu3fh9  frontend  replicated  15/50     nginx:alpine
+

You can also scale a service using the docker service update command. The following commands are equivalent:

$ docker service scale frontend=50
+$ docker service update --replicas=50 frontend
+

Scale multiple services

The docker service scale command allows you to set the desired number of tasks for multiple services at once. The following example scales both the backend and frontend services:

$ docker service scale backend=3 frontend=5
+
+backend scaled to 3
+frontend scaled to 5
+
+$ docker service ls
+
+ID            NAME      MODE        REPLICAS  IMAGE
+3pr5mlvu3fh9  frontend  replicated  5/5       nginx:alpine
+74nzcxxjv6fq  backend   replicated  3/3       redis:3.0.6
+

Parent command

Command Description
docker service Manage services
Command Description
docker service create Create a new service
docker service inspect Display detailed information on one or more services
docker service logs Fetch the logs of a service or task
docker service ls List services
docker service ps List the tasks of one or more services
docker service rm Remove one or more services
docker service rollback Revert changes to a service’s configuration
docker service scale Scale one or multiple replicated services
docker service update Update a service
+

+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
+ https://docs.docker.com/engine/reference/commandline/service_scale/ +

+
-- cgit v1.2.3