Answers: <p>docker stack api is introduced from docker version 1.12.0 and above.
  the api is enabled in swarm mode.</p>
  
  <p>to enable the docker stack api, run below command
  docker swarm init</p>
  
  <p>when you run the above command, your host would become single master docker swarm cluster.
  you should be able to use docker stack and docker service and other new api's.</p>
  
  <p>you can also add new hosts to the swarm cluster as a worker or manager</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-02T07:36:27.623Z
Answers: I think you are answering the wrong question
Answers: Marged
Answers: CC BY-SA 4.0
Answers: 2019-02-01T18:15:36.827Z
Answers: 2019-02-01T18:15:36.827Z
Answers: Ekambaram P
Answers: <blockquote>
    <p>Why it is mandatory to switch to swarm mode to run docker stack?</p>
  </blockquote>
  
  <p>A stack and service are swarm mode objects by their very definition. The stack is a collection of services, and each service is a definition of a target state. Swarm mode takes those target states and manages containers to achieve that target state.</p>
  
  <blockquote>
    <p>And most important, what are the implications of switching to swarm mode when working on a single node?</p>
  </blockquote>
  
  <p>Pretty minimal from the user perspective. There's another few ports opened and listening. If you try to directly manage containers (stop, rm, restart) that are managed by a service, you'll find that swarm mode will take steps to get you back to the service definition, which confuses some that keep finding new containers recreated when they delete all running containers directly. You just need to run the <code>docker service</code> commands to manage them instead.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-01T20:46:32.070Z
Answers: 2019-02-01T20:46:32.070Z
Answers: BMitch
Body: <p>I am experimenting with <code>docker stack</code> as a replacement to <code>docker-compose</code>. But I had the following message on my first deploy attempt:</p>
  
  <pre><code>sudo docker stack deploy --compose-file stack/app-stack.yml app-stack
  
  this node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again
  </code></pre>
  
  <p>Once issued the <code>docker swarm init</code> command, <code>docker stack deploy</code> works as expected.</p>
  
  <p>Why it is mandatory to switch to <em>swarm mode</em> to run <code>docker stack</code>? And most important, what are the implications of switching to <em>swarm mode</em> when working on a single node?</p>
  
Tags: <docker><docker-swarm>
Title: Why `docker stack` needs Docker to run in swarm mode? What are the implications when working on a single node?
UserDisplayName: Sylvain Leroux
ThreadText: # Why `docker stack` needs Docker to run in swarm mode? What are the implications when working on a single node?
  
  (Asked by: username_0 on 2019-02-01)
  
  I am experimenting with `docker stack` as a replacement to `docker-compose`. But I had the following message on my first deploy attempt:
  
  ```
  sudo docker stack deploy --compose-file stack/app-stack.yml app-stack
  
  this node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again
  
  ```
  
  Once issued the `docker swarm init` command, `docker stack deploy` works as expected.
  
  Why it is mandatory to switch to *swarm mode* to run `docker stack`? And most important, what are the implications of switching to *swarm mode* when working on a single node?
  
  **Tags:** docker, docker-swarm
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2019-02-01. Score: 3 | Accepted answer
  
  > Why it is mandatory to switch to swarm mode to run docker stack?
  
  A stack and service are swarm mode objects by their very definition. The stack is a collection of services, and each service is a definition of a target state. Swarm mode takes those target states and manages containers to achieve that target state.
  
  > And most important, what are the implications of switching to swarm mode when working on a single node?
  
  Pretty minimal from the user perspective. There's another few ports opened and listening. If you try to directly manage containers (stop, rm, restart) that are managed by a service, you'll find that swarm mode will take steps to get you back to the service definition, which confuses some that keep finding new containers recreated when they delete all running containers directly. You just need to run the `docker service` commands to manage them instead.
  
  
  ---
  
  ### Answer by username_1 on 2019-02-01. Score: -1
  
  docker stack api is introduced from docker version 1.12.0 and above.
  the api is enabled in swarm mode.
  
  to enable the docker stack api, run below command
  docker swarm init
  
  when you run the above command, your host would become single master docker swarm cluster.
  you should be able to use docker stack and docker service and other new api's.
  
  you can also add new hosts to the swarm cluster as a worker or manager
  
  > **Comments:**
  > **username_2**: I think you are answering the wrong question  
  
  ---
  
  