0
0
Dockerdevops~20 mins

Ambassador container pattern in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Ambassador Pattern Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Purpose of the Ambassador Container Pattern

What is the main purpose of using the Ambassador container pattern in a Docker environment?

ATo provide a proxy container that handles network communication for another container, enabling separation of concerns.
BTo run multiple unrelated applications inside a single container for resource efficiency.
CTo replace the main application container with a lightweight alternative for testing.
DTo automatically scale containers based on CPU usage without manual intervention.
Attempts:
2 left
💡 Hint

Think about how network communication can be managed separately from the main app.

💻 Command Output
intermediate
2:00remaining
Output of Docker Compose with Ambassador Pattern

Given the following docker-compose.yml snippet using an ambassador container, what will be the output of docker ps after starting the services?

Docker
version: '3.8'
services:
  app:
    image: myapp:latest
    networks:
      - appnet
  ambassador:
    image: alpine/socat
    command: TCP-LISTEN:8080,fork TCP:app:80
    networks:
      - appnet
networks:
  appnet:
AOnly one container running: 'app', since 'ambassador' is a network alias.
BThree containers running: 'app', 'ambassador', and a default network container.
CNo containers running because the 'ambassador' service has an invalid command.
DTwo containers running: 'app' and 'ambassador', both connected to 'appnet' network.
Attempts:
2 left
💡 Hint

Check how many services are defined and what docker ps shows.

🔀 Workflow
advanced
2:30remaining
Configuring Ambassador Container for TLS Termination

You want to use an ambassador container to handle TLS termination for your main app container. Which configuration snippet correctly sets up the ambassador container to listen on port 443 and forward decrypted traffic to the app on port 80?

Acommand: socat OPENSSL-LISTEN:443,reuseaddr,fork TCP:app:80
Bcommand: socat TCP-LISTEN:80,reuseaddr,fork OPENSSL:app:443,verify=0
Ccommand: socat TCP-LISTEN:443,reuseaddr,fork OPENSSL:app:80,verify=0
Dcommand: socat OPENSSL-LISTEN:80,reuseaddr,fork TCP:app:443
Attempts:
2 left
💡 Hint

Remember TLS termination means the ambassador decrypts incoming TLS traffic before forwarding.

Troubleshoot
advanced
2:00remaining
Diagnosing Ambassador Container Connection Failure

Your ambassador container fails to connect to the main app container, showing 'connection refused' errors. Which is the most likely cause?

AThe app container is running but has no exposed ports.
BThe ambassador container is not on the same Docker network as the app container.
CThe ambassador container image is missing the socat binary.
DThe Docker daemon is not running on the host machine.
Attempts:
2 left
💡 Hint

Check network connectivity between containers.

Best Practice
expert
3:00remaining
Best Practice for Updating Ambassador Container Without Downtime

What is the best practice to update an ambassador container in production to avoid downtime for the main application?

AStop the ambassador container, update the image, then restart it immediately.
BUpdate the main app container first, then restart the ambassador container.
CDeploy a new ambassador container alongside the old one, switch traffic, then remove the old container.
DRemove both ambassador and app containers, then redeploy them together.
Attempts:
2 left
💡 Hint

Think about zero downtime deployment strategies.