1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/docs/swarm/swarm-tutorial/deploy-service.md
Daniel Nephin 4df0349948 Change SCALE to REPLICAS.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-15 17:57:59 -04:00

1.5 KiB

Deploy a service to the Swarm

After you create a Swarm, you can deploy a service to the Swarm. For this tutorial, you also added worker nodes, but that is not a requirement to deploy a service.

  1. Open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine named manager1.

  2. Run the the following command:

    $ docker service create --replicas 1 --name helloworld alpine ping docker.com
    
    2zs4helqu64f3k3iuwywbk49w
    
    • The docker service create command creates the service.
    • The --name flag names the service helloworld.
    • 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 command ping docker.com.
  3. Run docker service ls to see the list of running services:

    $ docker service ls
    
    ID            NAME        REPLICAS  IMAGE   COMMAND
    2zs4helqu64f  helloworld  1         alpine  ping docker.com
    

What's next?

Now you've deployed a service to the Swarm, you're ready to inspect the service.