---
source: https://iinventedlight.com/library/notes/docker-swarm-mode-services.md
title: "Docker Swarm mode services: tasks, replicas, and global workloads"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache License 2.0 (Docker, Inc.); Apache License 2.0 (Docker, Inc.); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., How Swarm mode works: services; Docker, Inc., How Swarm mode works: services (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: docker-swarm-mode-services"
tags: [docker, swarm, services, tasks, replicas]
client: Librarian
sources:
  - id: S1
    title: "How Swarm mode works: services"
    publisher: Docker, Inc.
    url: https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/
    accessed: 2026-11-26
    license: "Apache License 2.0"
  - id: S2
    title: "How Swarm mode works: services (source)"
    publisher: Docker, Inc.
    url: https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/how-swarm-mode-works/services.md
    accessed: 2026-11-26
    license: "Apache License 2.0"
---
# Docker Swarm mode services: tasks, replicas, and global workloads
**Answer:** Creating a service means choosing the container image and the commands to execute inside running containers.

## Tasks and desired state

You also define options for the service, such as load balancing between three instances of an HTTP listener.

Each of the three instances of the listener is a task in the swarm.

A task moves only forward, monotonically, through states such as ASSIGNED, PREPARING, and RUNNING.

When a task fails, the orchestrator removes that task and container, then creates a replacement according to the service's desired state.

If no node currently in the swarm can run its tasks, the service remains in state pending. Placement constraints may not be able to be honored at a given time.

To prevent a service from being deployed, scale it to 0 rather than leaving it pending.

## Replicated and global services

Good candidates for global services are monitoring agents, anti-virus scanners, or other containers that you want to run on every node in the swarm.

For a replicated service, you specify the number of identical tasks you want to run, such as an HTTP service with three replicas, each serving the same content.

There are two types of service deployments, replicated and global.

A global service runs one task on every node, without a pre-specified number of tasks.

Adding a node to the swarm makes the orchestrator create a task, and the scheduler assigns it to the new node.

## See also

- [docker-swarm-services](https://iinventedlight.com/library/notes/docker-swarm-services/)
- [docker-swarm-key-concepts](https://iinventedlight.com/library/notes/docker-swarm-key-concepts/)
- [docker-swarm-manage-nodes](https://iinventedlight.com/library/notes/docker-swarm-manage-nodes/)

## Claims

- id: C1
  claim: Swarm mode has replicated services and global services.
  source: S1
  evidence: "There are two types of service deployments, replicated and global."

- id: C2
  claim: A global service places one task on every node.
  source: S1
  evidence: "A global service is a service that runs one task on every node."

- id: C3
  claim: The markdown source describes the same replicated and global deployment types.
  source: S2
  evidence: "There are two types of service deployments, replicated and global."

## Sources

- [S1] How Swarm mode works: services. Docker, Inc.. https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/ . License: Apache License 2.0. Accessed 2026-11-26.

- [S2] How Swarm mode works: services (source). Docker, Inc.. https://raw.githubusercontent.com/docker/docs/main/content/manuals/engine/swarm/how-swarm-mode-works/services.md . License: Apache License 2.0. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker, Inc., How Swarm mode works: services; Docker, Inc., How Swarm mode works: services (source). Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
