Deploy a service to the swarm (original) (raw)
This section
- Open source
- Administer and maintain a swarm of Docker Engines
- Deploy a stack to a swarm
- Deploy services to a swarm
- Join nodes to a swarm
- Lock your swarm to protect its encryption key
- Manage nodes in a swarm
- Manage sensitive data with Docker secrets
- Manage swarm service networks
- Raft consensus in swarm mode
- Run Docker Engine in swarm mode
- Store configuration data using Docker Configs
- Swarm mode key concepts
- Use Swarm mode routing mesh
- Administer and maintain a swarm of Docker Engines
- Deprecated features
- Engine v28
- Engine v27
- Engine v26.1
- Engine v26.0
- Engine v25.0
- Engine v24.0
- Engine v23.0
- Engine v20.10
- Engine v19.03
- Engine v18.09
- Engine v18.06
- Engine v18.05
- Engine v18.04
- Engine v18.03
- Engine v18.02
- Engine v18.01
- Engine v17.12
- Engine v17.11
- Engine v17.10
- Engine v17.09
- Engine v17.07
- Engine v17.06
- Engine v17.05
- Engine v17.04
- Engine v17.03
- Prior releases
- Engine v28
- Build checksNew
- Annotations
* Attestations
* Build checks
* Build secrets
* Build summary
* BuildKit configuration
* Cache management
* Copy image between registries
* Export to Docker
* Local registry
* Multi-platform image
* Named contexts
* Push to multiple registries
* Reproducible builds
* Share image between jobs
* Tags and labels
* Test before push
* Update Docker Hub description
- Annotations
- Build release notes
- Testcontainers
- AI
- Docker Model RunnerBeta
- Products
- Quickstart
- Create
- Repository information
* Access
* * Tags
* Image Management
* Software artifacts
* Push images
* Move images
* Image security insights
* Webhooks
* * Set up
* Link accounts
* Automated repository tests
* Advanced options
* Manage autobuilds
* Troubleshoot
* * Docker Official Images
* Docker Verified Publisher Program
* Docker-Sponsored Open Source Program
* Insights and analytics
- Repository information
- Archive
- Delete
- Personal settings
- Create
- Service accounts
- Troubleshoot
- Release notes
- Testcontainers Cloud
- Deprecated products and features
- Release lifecycle
- Platform
- Release notes
Home / Manuals / Docker Engine / Swarm mode / Getting started with Swarm mode / Deploy a service to the swarm
After youcreate a swarm, you can deploy a service to the swarm. For this tutorial, you alsoadded worker nodes, but that is not a requirement to deploy a service.
- Open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine named
manager1
. - Run the following command:
$ docker service create --replicas 1 --name helloworld alpine ping docker.com
9uk4639qpg7npwf3fn2aasksr
- The
docker service create
command creates the service. - The
--name
flag names the servicehelloworld
. - The
--replicas
flag specifies the desired state of 1 running instance. - The arguments
alpine ping docker.com
define the service as an Alpine Linux container that executes the commandping docker.com
.
- Run
docker service ls
to see the list of running services:
$ docker service ls
ID NAME SCALE IMAGE COMMAND
9uk4639qpg7n helloworld 1/1 alpine ping docker.com
Next steps
Now you're ready to inspect the service.