DNS-based discovery
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
use DNS names for service-to-service calls.
Planned topics
- In Docker Compose, every service name is a DNS name on the Compose network:
http://inventory:8080. - With several replicas, the name resolves to the replicas' addresses (Docker's internal DNS rotates among them).
- Clients and JVMs may cache DNS results; check the JVM's DNS cache TTL and connection pooling (verify settings before recording).
- Pooled keep-alive connections stay on one replica until closed, which skews balancing.
- No library needed: configuration is just a hostname.
Draft outline details
Demonstration
services:
inventory:
image: shop/inventory
deploy: { replicas: 3 }
orders:
environment:
INVENTORY_URL: http://inventory:8080Check your understanding
What does orders need to know to reach inventory?
Show answer
Only the name inventory and the port.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.