i'm learning about docker swarm, and got confused about the swarm discovery option, i see that lots of tutorials on internet use this option to create containers with docker-machine, but when i enter the documentation on docker swarm doc it says:
You are viewing docs for legacy standalone Swarm. These topics describe standalone Docker Swarm. In Docker 1.12 and higher, Swarm mode is integrated with Docker Engine. Most users should use integrated Swarm mode.
So, what are the use cases for the discovery options? All the tutorials use the docker-machine to create a swarm, i always need it or can just install the docker on machines in my cluster, join them in swarm and use normal?
I saw some names like Docker Swarm
and Docker Swarm Mode
, are there any difference or just different ways to call the same feature?
Docker Swarm is not being deprecated, and is still a viable method for Docker multi-host orchestration, but Docker Swarm Mode (which uses the Swarmkit libraries under the hood) is the recommended way to begin a new Docker project where orchestration over multiple hosts is required.
Docker Swarm Mode is great to deploy your application stacks to production, in a distributed cluster, using the same files used by Docker Compose locally.
Docker Swarm is an ecosystem to deploy your docker container application into multiple environments for best ressource management. Kubernetes is the alternative to Docker swarm. Thats the best summary. going from top to bottom is how you should proceed in your learning.
The Docker Swarm service discovery contains 3 different roles: nodes, services, and tasks. The first role, nodes, represents the hosts that are part of the Swarm. It can be used to automatically monitor the Docker daemons or the Node Exporters who run on the Swarm hosts.
Q. Docker Swarm discovery is still relevant?
A: No, if you use docker Swarm Mode
and an overlay network
(see below)
Q. Are there any difference between Docker Swarm
and Docker Swarm Mode
?
A: Yes, TL;DR Docker Swarm
is deprecated and should not be used anymore, Docker Swarm Mode
(we should just say Swarm Mode
) is the recommended way of clustering containers and have reliability, load-balancing, scaling, and rolling service upgrades.
Docker Swarm
(official doc) :
Docker Swarm
clusterSwarm Mode
(official doc):
managers
/ workers
)Docker engine
, you don't need an additional containeroverlay network
(DNS resolution is done within this network), you don't need an additional containerYou can have a look to this SO thread on same topic.
Q. Do i always need docker-machine
to create a swarm?
A: No, docker-machine
is a helper to create virtual hosts in the cloud like amazon ec2, azure, digitalocean, google, openstack..., or your own network with virtual box.
To create a Swarm Mode
, you need :
docker-machine
facilitates)docker swarm init
to switch to Swarm Mode
on your first manager nodedocker swarm join
on worker nodes to add them in the clusterThere are some subtle adjustments to Swarm mode
to increase high availability (recommended number of managers in the swarm, node placement in multiple availability zones in the cloud)
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With