Service Discovery

Learn how to use Docker's service discovery and customized DNS options for container communication.

As well as core networking, libnetwork also provides service discovery that allows all containers and Swarm services to locate each other by name. The only requirement is that the containers should be on the same network. Under the hood, Docker implements a native DNS server and configures every container to use it for name resolution.

The figure below shows a container called c1 pinging another container called c2 by name. The same principle applies to Swarm service replicas.

Press + to interact
 Container c1 pinging another container c2
Container c1 pinging another container c2

Service discovery process

Let’s step through the process.

    ...
    Access this course and 1400+ top-rated courses and projects.