github.com/noxiouz/docker@v0.7.3-0.20160629055221-3d231c78e8c5/docs/swarm/swarm-tutorial/deploy-service.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Deploy a service"
     4  description = "Deploy a service to the swarm"
     5  keywords = ["tutorial, cluster management, swarm mode"]
     6  advisory = "rc"
     7  [menu.main]
     8  identifier="deploy-application"
     9  parent="swarm-tutorial"
    10  weight=16
    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      9uk4639qpg7npwf3fn2aasksr
    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      9uk4639qpg7n  helloworld  1/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).