docker-service
manage containerized services in Docker Swarm
TLDR
SYNOPSIS
docker service command [options]
DESCRIPTION
docker service manages Swarm services. A service is a declaration of how a set of containers should run across a swarm: image, replica count, networks, mounts, secrets, resource limits, and update strategy. The swarm orchestrator schedules tasks (container instances) on cluster nodes and maintains the desired state, replacing failed tasks and routing traffic via the routing mesh.Service commands are only available on a Docker host participating in a swarm; initialize one with docker swarm init before using them. Updates are applied as rolling updates by default, with rollback available to revert to the previous service spec.
SUBCOMMANDS
create
Create a new service.ls
List services.inspect
Display detailed information.update
Update a service.scale
Scale services.logs
Fetch service logs.ps
List tasks of a service.rm
Remove services.rollback
Revert a service to its previous specification.
COMMON OPTIONS
--replicas n (create/scale)
Number of replicated tasks to run.--mode mode (create)
replicated (default) or global (one task per node).--publish published:target (create)
Publish a port externally (e.g. `8080:80`).--network name (create)
Attach the service to a swarm overlay network.--env, -e KEY=VAL (create/update)
Set environment variables.--constraint expr (create)
Placement constraints (e.g. `node.role==worker`).--update-parallelism n / --update-delay dur (create/update)
Rolling-update concurrency and delay between batches.
CAVEATS
Requires swarm mode (docker swarm init / join). For single-host workloads use docker run or docker compose instead. Rolling updates with --update-parallelism 0 will replace all tasks at once and can cause downtime.
SEE ALSO
docker-swarm(1), docker-node(1), docker(1), docker-compose(1)
