Docker Community Forums

Share and learn in the Docker community.

Compose and Swarm do not work together


(Yashgt) #1

I have noticed a glaring contradiction:

The documentation at https://docs.docker.com/compose/swarm/ says that compose and swarm work together and that running docker-compose up will cause a multi-host deployment.

When I tried it I got:

[admin@gol05854 compose]$ docker-compose up -d
WARNING: Some networks were defined but are not used by any service: mynet
WARNING: The Docker Engine you’re using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use the bundle feature of the Docker experimental build.

More info:


(Tibmeister) #2

I’m glad I’m not the only one who noticed it; just thought I was going crazy.


(Yogeek) #3

Be careful : docker-compose works with “Docker Swarm” (the historic orchestrator project of Docker, which is outside Docker Engine) but according to the log you have, it seems that you are in fact using the “swarm mode” which is the new orchestration solution integrated in Docker Engine since the 1.12 version. And this new orchestrator solution, “swarm mode”, does not work with docker-compose.

To initialize a " swarm-mode", you can follow the documentation here : https://docs.docker.com/engine/swarm/swarm-tutorial/
And to deploy an entire stack in the swarm-mode cluster (the equivalent of the old “Docker-Compose on Docker Swarm” way), you have to use the “bundle” experimental feature as explained here : https://docs.docker.com/compose/bundles/

Things are a little bit different but you will see that these new concepts of Docker 1.12 with swarm-mode are really great !


(Yashgt) #4

Thanks for pointing that out. However, the bundle feature does not work
when deploying across multiple hosts. This is being tracked in issue: