NetOps Observer
← All labs

Network connectivity / Intermediate / 20–30 min

The service listening on the wrong interface

A healthy HTTP service cannot be reached from a neighboring container. Investigate its listening address and restore connectivity.

LAB IDnetops-02-loopback-listenerTRACK / netops.observer
Engineer inspecting network switches and cables

The scenario

A client can resolve the service name but receives a connection refusal. The service works from inside its own container. Diagnose the listening interface and restore access over the isolated lab network.

Mission objectives

  • Reproduce the failed client connection and confirm name resolution.
  • Compare the service's local and network-facing listener.
  • Restore the client connection without publishing a host port.

Watch the explanation

An explanation of why a service listening on container loopback cannot be reached from another container.

Watch the video ↗

Lab README

The service listening on the wrong interface

The client resolves api, but its HTTP connection is refused. The service responds from its own container. Find why these observations differ and restore the client request without publishing a host port.

Before you begin

Use a disposable machine with Bash, Python 3, Docker and Docker Compose. The lab creates the Compose project breakfix-netops-02 and an internal network; it publishes no host ports. Docker may pull the Python image. Do not reuse this project name for other work. Setup refuses existing project resources, and teardown checks container ownership before removal.

Run and investigate

From this directory, run ./setup.sh. The following commands show the service status, logs and the client-side symptom:

docker compose -p breakfix-netops-02 ps
docker compose -p breakfix-netops-02 logs api
docker compose -p breakfix-netops-02 exec client python /lab/probe.py api

Inspect the service configuration and compare a request from within the service container. Configuration changes require recreating the service. Run ./verify.sh after making your change and ./teardown.sh when finished. Teardown removes the lab containers and network, but does not reset edited files; re-extract the bundle to start over.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/netops-02-loopback-listener.sh
less netops-02-loopback-listener.sh
bash netops-02-loopback-listener.sh
cd labs/netops-02-loopback-listener
./setup.sh

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

Compare the service logs and local health check with the client connection attempt.

Hint #2

Loopback is private to each container's network namespace. Inspect the listener configuration and recreate the service after changing it.

Hint #3 · Related guide on opsbreakfix.com

Read the related guide ↗

Solved it?

Explore the related guide on opsbreakfix.com.

Continue to opsbreakfix.com ↗

One ecosystem.
Many perspectives.

Follow the connection from a hands-on lab to the knowledge and tools behind it.