github.com/kobeld/docker@v1.12.0-rc1/docs/swarm/swarm-tutorial/deploy-service.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Deploy a service"
     4  description = "Deploy the application"
     5  keywords = ["tutorial, cluster management, swarm"]
     6  [menu.main]
     7  identifier="deploy-application"
     8  parent="swarm-tutorial"
     9  weight=16
    10  advisory = "rc"
    11  +++
    12  <![end-metadata]-->
    13  
    14  # Deploy a service to the Swarm
    15  
    16  After you [create a Swarm](create-swarm.md), you can deploy a service to the
    17  Swarm. For this tutorial, you also [added worker nodes](add-nodes.md), but that
    18  is not a requirement to deploy a service.
    19  
    20  1. Open a terminal and ssh into the machine where you run your manager node. For
    21  example, the tutorial uses a machine named `manager1`.
    22  
    23  2. Run the the following command:
    24  
    25      ```bash
    26      $ docker service create --replicas 1 --name helloworld alpine ping docker.com
    27  
    28      2zs4helqu64f3k3iuwywbk49w
    29      ```
    30  
    31      * The `docker service create` command creates the service.
    32      * The `--name` flag names the service `helloworld`.
    33      * The `--replicas` flag specifies the desired state of 1 running instance.
    34      * The arguments `alpine ping docker.com` define the service as an Alpine
    35      Linux container that executes the command `ping docker.com`.
    36  
    37  3. Run `docker service ls` to see the list of running services:
    38  
    39      ```
    40      $ docker service ls
    41  
    42      ID            NAME        SCALE  IMAGE   COMMAND
    43      2zs4helqu64f  helloworld  1      alpine  ping docker.com
    44      ```
    45  
    46  ## What's next?
    47  
    48  Now you've deployed a service to the Swarm, you're ready to [inspect the service](inspect-service.md).
    49  
    50  <p style="margin-bottom:300px">&nbsp;</p>