Docker Community Forums

Share and learn in the Docker community.

Is Swarm what I am looking for?


(Madleeen) #1

Hi,
I am quite new to Docker and I found out that documentation doesn’t give me many answers.
I need to use docker for testing application (in Tomcat for example) - that is ok, we are using it.
But because we need to run a lot of containers at the same moment I want to have more machines with docker engine - I thought I can use Swarm for this - I will send request like “docker run …” to the manager and he will check which work is free and ready and will run it there. That’s all I want - basically load balancer.
Is it really what is that for? (I don’t care much about service discovery).
The thing is that I am trying it now (1.12v) and I am not sure anymore that Swarm is what I need, because I can’t simply use docker run commands as before and docker service is problematic (for example I want to use -P to map on random ports, etc.).
Can someone tell me how is it …maybe there is something else for my use case?
Thanks.


(Charlessmith) #2

@madleeen, I’m unsure of your use case, but swarm mode in Docker 1.12 does provide load balancing. The documentation for swarm mode is a work in progress, but maybe the following will help.

You can publish a port for a service using the --publish flag for docker service create. You can see an example in the “play with service” section of this blog post: https://feiskyer.github.io/2016/06/24/Play-with-docker-v1-12/

HTH.


(Madleeen) #3

I just want to run individual containers in swarm mode. Which someone on IRC told be that cannot be done (in swarm mode), therefore I am now trying to install full docker swarm. It is confusing.
I needed flag --publishall (or -P), which I didn’t find how to make it working.


(Nickdoikov) #4

We are using swarm for massive running containers with different constraints (using for regions separation).
We use external non-containerized swarm and consul cluster with lb in front of it .
As i know swarm can be used in 1.12 same way without docker native swarm mode.

swarm we using in standalone mode (currently we using upastart because in our case we have artifacts and incnistency because our containers kill themselves afer processing tasks and jobber clean them very fast)