Service discovery dynamically locates a service and provides the network address needed to communicate with it. In Docker Compose, containers on the same Docker network can use service names instead of unstable container IP addresses. Docker’s built-in DNS resolves a container name to its current IP address, and forwards non-container names to the host’s normal DNS. section 7.3
The practical workflow is:
- Start or scale the Compose application. section 7.3
- Connect to a running web container using its Linux or Windows shell. section 7.3
- Run nslookup against a service name such as accesslog or iotd; one container returns one address, while a scaled service can return multiple addresses. section 7.3
docker container rm -f image-of-the-day-accesslog-1 docker compose up -d --scale iotd=3 # for Linux containers: docker container exec -it image-of-the-day-image-gallery-1 sh # for Windows containers: docker container exec -it image-of-the-day-image-gallery-1 cmd # inside the container session: nslookup accesslog nslookup iotd exit
Practice service discovery by removing a container, scaling the application, entering the web container, and looking up both accesslog and iotd. section 7.3






