Do you not need service discovery to deploy microservices using dodcker swarm?

  docker, question

Recently, I started to understand micro-service and docker. The problem may be naive or wrong. Please don’t laugh at me.

After a microservice is started, it will register its ip address and port in the registration center, so when other services call the service, they only need to obtain the ip and port of the service from the registration center, and there is no need to hard-code the ip information of the called service.

In docker swarm, when calling a micro-service, with the help of built-in DNS and load balancing, the ip address of the corresponding service can be found through a service name.

Therefore, when using docker swarm to deploy microservices, can service discovery and registration of microservices be easily realized without using other service discovery and registration tools?

This is my personal understanding of docker swarm’s deployment of micro-services, isn’t it?

Or am I wrong about the concept and understanding of service discovery and registration of micro-services and the deployment of micro-services by swarm?

Thank you for inviting:
Yes, absolutely. swarm has built-in service discovery and load balancing. swarm contains DNS components and can automatically assign DNS to each service in the cluster. Manager distributes requests between services within the cluster based on the DNS name of the service through internal load balancing. However, under the condition of ensuring high availability, most of them still recommend using etcd etc. to make it more flexible and highly available.