0
0
Dockerdevops~10 mins

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

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

Complete the code to start all services defined in a Docker Compose file.

Docker
docker-compose [1]
Drag options to blanks, or click blank then click option'
Abuild
Brun
Cup
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build' instead of 'up' will only build images but not start containers.
Using 'stop' will stop running containers, not start them.
2fill in blank
medium

Complete the code to define a service named 'web' in a Docker Compose YAML file.

Docker
services:
  web:
    image: nginx
    ports:
      - "80:[1]"
Drag options to blanks, or click blank then click option'
A80
B8080
C443
D3000
Attempts:
3 left
💡 Hint
Common Mistakes
Using 8080 or 3000 as container port will not work with default nginx.
Using 443 is for HTTPS, not default HTTP.
3fill in blank
hard

Fix the error in the Docker Compose command to rebuild images before starting containers.

Docker
docker-compose [1] --build
Drag options to blanks, or click blank then click option'
Arun
Bup
Cstart
Dbuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' ignores the --build flag.
Using 'build' only builds images but does not start containers.
4fill in blank
hard

Fill both blanks to define a volume named 'db-data' and mount it to '/var/lib/mysql' in the 'db' service.

Docker
services:
  db:
    image: mysql
    volumes:
      - [1]:[2]
Drag options to blanks, or click blank then click option'
Adb-data
B/var/lib/mysql
C/data
Dmysql-data
Attempts:
3 left
💡 Hint
Common Mistakes
Using '/data' instead of '/var/lib/mysql' will not persist MySQL data correctly.
Using 'mysql-data' instead of 'db-data' changes the volume name.
5fill in blank
hard

Fill all three blanks to define a network named 'app-net', attach 'web' and 'db' services to it in Docker Compose.

Docker
networks:
  [1]:

services:
  web:
    image: nginx
    networks:
      - [2]

  db:
    image: mysql
    networks:
      - [3]
Drag options to blanks, or click blank then click option'
Aapp-net
Bdefault
Dbackend-net
Attempts:
3 left
💡 Hint
Common Mistakes
Using different network names breaks service communication.
Using 'default' network name when a custom network is defined.