0
0
Dockerdevops~10 mins

Ambassador container pattern in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Docker command to run an ambassador container named 'amb' that forwards traffic to port 8080.

Docker
docker run -d --name amb -p 9090:[1] ambassador-image
Drag options to blanks, or click blank then click option'
A8080
B3000
C443
D80
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong port number for forwarding.
Confusing host and container ports.
2fill in blank
medium

Complete the Docker Compose service definition to link the ambassador container to the main app container.

Docker
services:
  app:
    image: myapp
  ambassador:
    image: ambassador-image
    depends_on:
      - [1]
Drag options to blanks, or click blank then click option'
Aproxy
Bdatabase
Ccache
Dapp
Attempts:
3 left
💡 Hint
Common Mistakes
Linking to unrelated services like database or cache.
Missing the depends_on field.
3fill in blank
hard

Fix the error in the ambassador container's environment variable to set the target host correctly.

Docker
environment:
  TARGET_HOST=[1]
Drag options to blanks, or click blank then click option'
A"app"
Bapp
C"localhost"
Dlocalhost
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting string values.
Using localhost instead of the service name.
4fill in blank
hard

Fill both blanks to complete the ambassador container's command to forward traffic to the app service on port 8080.

Docker
command: ["[1]", "[2]"]
Drag options to blanks, or click blank then click option'
Aproxy
Bapp
C8080
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'proxy'.
Wrong port number.
5fill in blank
hard

Fill all three blanks to define a Docker Compose network and attach both app and ambassador containers to it.

Docker
networks:
  [1]:
    driver: [2]

services:
  app:
    image: myapp
    networks:
      - [3]
  ambassador:
    image: ambassador-image
    networks:
      - [3]
Drag options to blanks, or click blank then click option'
Afrontend_net
Bbridge
Dhost
Attempts:
3 left
💡 Hint
Common Mistakes
Using different network names in definition and services.
Using 'host' driver which is less common.