Skip to content

Scaling a service: three api containers

Select an icon to see what it is.

Step 3 of 6

The name api returns all three

When web looks up api, the embedded DNS server at 127.0.0.11 answers with every address that has that alias. Docker shuffles them into a random order on each lookup, so different lookups can lead with different containers.

$ docker compose exec web getent ahostsv4 api

DNS answer (decoded message, example: the order is random)

api A 172.18.0.3
api A 172.18.0.5
api A 172.18.0.6