1

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?

2 Answers 2

3

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.

-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

1
  • 1
    I think you are answering the wrong question
    – Marged
    Commented Feb 2, 2019 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.