0
0
Dockerdevops~10 mins

docker-compose.yml structure - Interactive Code Practice

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

Complete the code to specify the version of the docker-compose file.

Docker
version: '[1]'
Drag options to blanks, or click blank then click option'
A3.8
Bv3
C3
Dversion3
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'v3' or 'version3' instead of just the version number.
Leaving the version field empty.
2fill in blank
medium

Complete the code to define the services section in docker-compose.yml.

Docker
services:
  [1]:
Drag options to blanks, or click blank then click option'
Acontainers
Bservices
Cweb
Dapps
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'containers' or 'services' as a service name.
Using plural names which are not typical.
3fill in blank
hard

Fix the error in the service definition to specify the image to use.

Docker
services:
  app:
    image: [1]
Drag options to blanks, or click blank then click option'
Amyapp/latest
Bmyapp:latest
Cmyapp_latest
Dmyapp latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using slash '/' instead of colon ':' to separate image and tag.
Using spaces in the image name.
4fill in blank
hard

Fill both blanks to define ports mapping and restart policy.

Docker
services:
  db:
    ports:
      - '[1]:5432'
    restart: [2]
Drag options to blanks, or click blank then click option'
A5433
Balways
Cnever
D5432
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same port number for host and container without reason.
Using invalid restart policy values.
5fill in blank
hard

Fill all three blanks to define environment variables, volumes, and command for a service.

Docker
services:
  redis:
    environment:
      - REDIS_PASSWORD=[1]
    volumes:
      - [2]:/data
    command: [3]
Drag options to blanks, or click blank then click option'
Amysecret
B./redisdata
C"redis-server --requirepass mysecret"
Dredisdata
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around environment variable values incorrectly.
Using relative paths incorrectly in volumes.
Not quoting the command string properly.