0
0
Dockerdevops~10 mins

Why data persistence matters in Docker - Test Your Understanding

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

Complete the code to run a Docker container that keeps data after it stops.

Docker
docker run -d --name mycontainer -v [1]:/data busybox
Drag options to blanks, or click blank then click option'
A/host/data
B/container/data
C/tmp
D/var/log
Attempts:
3 left
💡 Hint
Common Mistakes
Using a container path instead of a host path for volume mapping.
2fill in blank
medium

Complete the command to create a named Docker volume called 'myvol'.

Docker
docker volume [1] myvol
Drag options to blanks, or click blank then click option'
Acreate
Blist
Cinspect
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' or 'list' instead of 'create'.
3fill in blank
hard

Fix the error in the Docker run command to properly mount a volume named 'myvol' to '/app/data'.

Docker
docker run -d --name appcontainer -v [1]:/app/data busybox
Drag options to blanks, or click blank then click option'
Avolumes/myvol
Bvolume:myvol
Cmyvol
D/myvol
Attempts:
3 left
💡 Hint
Common Mistakes
Adding slashes or prefixes to the volume name.
4fill in blank
hard

Fill both blanks to create a Docker volume and run a container using it.

Docker
docker volume [1] mydata && docker run -d -v [2]:/data alpine
Drag options to blanks, or click blank then click option'
Acreate
Bmydata
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' instead of 'create' or wrong volume name.
5fill in blank
hard

Fill all three blanks to define a Docker Compose service with a volume for data persistence.

Docker
services:
  db:
    image: postgres
    volumes:
      - [1]:[2]
volumes:
  [3]:
Drag options to blanks, or click blank then click option'
Adbdata
B/var/lib/postgresql/data
Dmyvolume
Attempts:
3 left
💡 Hint
Common Mistakes
Using different volume names or wrong container paths.