github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/docs/reference/commandline/stack_deploy.md (about)

     1  ---
     2  title: "stack deploy"
     3  description: "The stack deploy command description and usage"
     4  keywords: "stack, deploy, up"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/cli GitHub
     8       repository at https://github.com/docker/cli/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # stack deploy
    17  
    18  ```markdown
    19  Usage:  docker stack deploy [OPTIONS] STACK
    20  
    21  Deploy a new stack or update an existing stack
    22  
    23  Aliases:
    24    deploy, up
    25  
    26  Options:
    27        --bundle-file string    Path to a Distributed Application Bundle file
    28    -c, --compose-file strings  Path to a Compose file, or "-" to read from stdin
    29        --help                  Print usage
    30        --kubeconfig string     Kubernetes config file
    31        --namespace string      Kubernetes namespace to use
    32        --orchestrator string   Orchestrator to use (swarm|kubernetes|all)
    33        --prune                 Prune services that are no longer referenced
    34        --resolve-image string  Query the registry to resolve image digest and supported platforms
    35                                ("always"|"changed"|"never") (default "always")
    36        --with-registry-auth    Send registry authentication details to Swarm agents
    37  ```
    38  
    39  ## Description
    40  
    41  Create and update a stack from a `compose` or a `dab` file on the swarm. This command
    42  has to be run targeting a manager node.
    43  
    44  ## Examples
    45  
    46  ### Compose file
    47  
    48  The `deploy` command supports compose file version `3.0` and above.
    49  
    50  ```bash
    51  $ docker stack deploy --compose-file docker-compose.yml vossibility
    52  
    53  Ignoring unsupported options: links
    54  
    55  Creating network vossibility_vossibility
    56  Creating network vossibility_default
    57  Creating service vossibility_nsqd
    58  Creating service vossibility_logstash
    59  Creating service vossibility_elasticsearch
    60  Creating service vossibility_kibana
    61  Creating service vossibility_ghollector
    62  Creating service vossibility_lookupd
    63  ```
    64  
    65  The Compose file can also be provided as standard input with `--compose-file -`:
    66  
    67  ```bash
    68  $ cat docker-compose.yml | docker stack deploy --compose-file - vossibility
    69  
    70  Ignoring unsupported options: links
    71  
    72  Creating network vossibility_vossibility
    73  Creating network vossibility_default
    74  Creating service vossibility_nsqd
    75  Creating service vossibility_logstash
    76  Creating service vossibility_elasticsearch
    77  Creating service vossibility_kibana
    78  Creating service vossibility_ghollector
    79  Creating service vossibility_lookupd
    80  ```
    81  
    82  If your configuration is split between multiple Compose files, e.g. a base
    83  configuration and environment-specific overrides, you can provide multiple
    84  `--compose-file` flags.
    85  
    86  ```bash
    87  $ docker stack deploy --compose-file docker-compose.yml -c docker-compose.prod.yml vossibility
    88  
    89  Ignoring unsupported options: links
    90  
    91  Creating network vossibility_vossibility
    92  Creating network vossibility_default
    93  Creating service vossibility_nsqd
    94  Creating service vossibility_logstash
    95  Creating service vossibility_elasticsearch
    96  Creating service vossibility_kibana
    97  Creating service vossibility_ghollector
    98  Creating service vossibility_lookupd
    99  ```
   100  
   101  You can verify that the services were correctly created:
   102  
   103  ```bash
   104  $ docker service ls
   105  
   106  ID            NAME                               MODE        REPLICAS  IMAGE
   107  29bv0vnlm903  vossibility_lookupd                replicated  1/1       nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
   108  4awt47624qwh  vossibility_nsqd                   replicated  1/1       nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
   109  4tjx9biia6fs  vossibility_elasticsearch          replicated  1/1       elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
   110  7563uuzr9eys  vossibility_kibana                 replicated  1/1       kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
   111  9gc5m4met4he  vossibility_logstash               replicated  1/1       logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
   112  axqh55ipl40h  vossibility_vossibility-collector  replicated  1/1       icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
   113  ```
   114  
   115  ### DAB file
   116  
   117  ```bash
   118  $ docker stack deploy --bundle-file vossibility-stack.dab vossibility
   119  
   120  Loading bundle from vossibility-stack.dab
   121  Creating service vossibility_elasticsearch
   122  Creating service vossibility_kibana
   123  Creating service vossibility_logstash
   124  Creating service vossibility_lookupd
   125  Creating service vossibility_nsqd
   126  Creating service vossibility_vossibility-collector
   127  ```
   128  
   129  You can verify that the services were correctly created:
   130  
   131  ```bash
   132  $ docker service ls
   133  
   134  ID            NAME                               MODE        REPLICAS  IMAGE
   135  29bv0vnlm903  vossibility_lookupd                replicated  1/1       nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
   136  4awt47624qwh  vossibility_nsqd                   replicated  1/1       nsqio/nsq@sha256:eeba05599f31eba418e96e71e0984c3dc96963ceb66924dd37a47bf7ce18a662
   137  4tjx9biia6fs  vossibility_elasticsearch          replicated  1/1       elasticsearch@sha256:12ac7c6af55d001f71800b83ba91a04f716e58d82e748fa6e5a7359eed2301aa
   138  7563uuzr9eys  vossibility_kibana                 replicated  1/1       kibana@sha256:6995a2d25709a62694a937b8a529ff36da92ebee74bafd7bf00e6caf6db2eb03
   139  9gc5m4met4he  vossibility_logstash               replicated  1/1       logstash@sha256:2dc8bddd1bb4a5a34e8ebaf73749f6413c101b2edef6617f2f7713926d2141fe
   140  axqh55ipl40h  vossibility_vossibility-collector  replicated  1/1       icecrime/vossibility-collector@sha256:f03f2977203ba6253988c18d04061c5ec7aab46bca9dfd89a9a1fa4500989fba
   141  ```
   142  
   143  ## Related commands
   144  
   145  * [stack ls](stack_ls.md)
   146  * [stack ps](stack_ps.md)
   147  * [stack rm](stack_rm.md)
   148  * [stack services](stack_services.md)