Skip to content

From Compose to Swarm to Kubernetes

Select an icon to see what it is.

Step 2 of 6

Swarm: one command makes a manager

docker swarm init turns this host into a Swarm manager, with a POST to /swarm/init. docker service create then sends the desired state: an image, three replicas and a published port. The manager stores it and schedules tasks.

$ docker service create --name api --replicas 3 -p 8080:80 nginx

POST /v1.45/swarm/init

{
"AdvertiseAddr": "10.0.0.20"
}