Troubleshooting configuration

Repair a reversed port mapping

Lesson 19 of 20 · 12 min · Module 6: Operate a complete stack

Use the mismatch between expected and configured ports to form a precise repair.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • State expected behavior before editing
  • Find the smallest mismatched boundary

The idea

Compose describes services and their relationships as YAML mappings and sequences. Read the whole service graph, including access and storage boundaries.

01State expected behavior before editing

Write down the listening application port and the port users contact. This turns a vague connection error into two concrete endpoints.

02Find the smallest mismatched boundary

The starter forwards host 3000 to container 8080, the reverse of the intended mapping. Changing the application code would address the wrong layer.

03Preserve unrelated working settings

A focused repair keeps the image and service discovery configuration intact. Recheck cache exposure as well as the repaired API entry point.

Your turn

The app listens on 3000 and users connect to host 8080. Repair the starter mapping. Keep the API image and CACHE_HOST=cache; keep cache unexposed.

What the checks look for

  • Corrects host-to-container direction
  • Preserves image and discovery
  • Leaves cache internal
Try it in the editor →

Take this with you

Diagnose a boundary, repair it narrowly, and verify the preserved behavior.

Go a little further

Explain how you would distinguish a DNS failure from a reversed port mapping.

Learn Docker & Containers for free

20 short lessons with real code and instant checks.

See the whole course →