Bird
0
0

Given this pod spec snippet, what will be the hostname your app container uses to reach the ambassador container?

medium📝 Command Output Q13 of 15
Docker - Production Patterns
Given this pod spec snippet, what will be the hostname your app container uses to reach the ambassador container?
{
  "containers": [
    {"name": "app", "image": "myapp"},
    {"name": "ambassador", "image": "ambassador-image"}
  ]
}
A"external-service"
B"ambassador"
C"127.0.0.1"
D"localhost"
Step-by-Step Solution
Solution:
  1. Step 1: Understand pod networking

    Containers in the same pod share the network namespace, so they communicate over localhost or 127.0.0.1.
  2. Step 2: Identify hostname for ambassador

    The ambassador container listens on localhost inside the pod, so the app uses "localhost" or "127.0.0.1" to reach it.
  3. Final Answer:

    "localhost" -> Option D
  4. Quick Check:

    Same pod communication = localhost [OK]
Quick Trick: Same pod containers use localhost to communicate [OK]
Common Mistakes:
  • Using container name as hostname inside pod
  • Using external service name instead of localhost
  • Confusing IP addresses inside pod

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes