0
0
Dockerdevops~20 mins

Why Docker Compose simplifies multi-container apps - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Compose Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Docker Compose benefits
Which of the following best explains why Docker Compose simplifies managing multi-container applications?
AIt automatically converts containers into virtual machines for better isolation.
BIt replaces Docker Engine and runs containers faster by using a different runtime.
CIt allows defining all containers and their settings in a single YAML file, enabling easy startup and management with one command.
DIt requires writing separate scripts for each container to manage their lifecycle.
Attempts:
2 left
💡 Hint
Think about how you would start multiple containers together easily.
💻 Command Output
intermediate
2:00remaining
Output of docker-compose up command
What is the expected output when running docker-compose up for a valid docker-compose.yml defining two services?
Docker
version: '3'
services:
  web:
    image: nginx
  db:
    image: mysql
A
Starting web ... done
Starting db ... done
Attaching to web, db
BSyntax error in docker-compose.yml at line 2
C
Container web created
Container db created
No output attached
DError: docker-compose.yml file not found
Attempts:
2 left
💡 Hint
Think about what happens when containers start successfully.
Configuration
advanced
2:30remaining
Correct service dependency declaration in Docker Compose
Which docker-compose.yml snippet correctly ensures that the web service starts only after the db service is ready?
A
services:
  web:
    image: nginx
    depends_on:
      - db
  db:
    image: mysql
B
services:
  web:
    image: nginx
    links:
      - db
  db:
    image: mysql
C
services:
  web:
    image: nginx
    wait_for:
      - db
  db:
    image: mysql
D
services:
  web:
    image: nginx
    start_after:
      - db
  db:
    image: mysql
Attempts:
2 left
💡 Hint
Look for the official Docker Compose keyword for service dependencies.
Troubleshoot
advanced
2:30remaining
Diagnosing Docker Compose network issue
You have two services in docker-compose.yml: app and db. The app service cannot connect to db using the service name as hostname. What is the most likely cause?
AThe <code>db</code> service image is missing the database software.
BThe services are defined under different networks, so they cannot resolve each other by service name.
CDocker Compose does not support service name resolution between containers.
DThe <code>app</code> service is missing a volume mount for the database files.
Attempts:
2 left
💡 Hint
Think about how Docker Compose handles container networking by default.
🔀 Workflow
expert
3:00remaining
Order of commands to update a multi-container app with Docker Compose
What is the correct order of commands to update the images and restart all services in a Docker Compose multi-container app?
A2,1,3,4
B2,3,1,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
Pull new images first, then stop old containers, then start updated ones.