0
0
Dockerdevops~10 mins

Volumes for persistent data 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 create a volume named 'mydata'.

Docker
docker volume [1] mydata
Drag options to blanks, or click blank then click option'
Abuild
Bcreate
Crun
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'docker volume run' instead of 'create'.
Trying to create volume with 'docker run'.
2fill in blank
medium

Complete the Docker run command to mount a volume named 'mydata' to '/app/data' inside the container.

Docker
docker run -v [1]:/app/data myimage
Drag options to blanks, or click blank then click option'
Amydata
B/mydata
Cmydata:/app/data
Dmydata:/data
Attempts:
3 left
💡 Hint
Common Mistakes
Adding slashes before volume name.
Using incorrect path after colon.
3fill in blank
hard

Fix the error in the Docker run command to mount a host directory '/data' as a volume inside the container at '/app/data'.

Docker
docker run -v [1]:/app/data myimage
Drag options to blanks, or click blank then click option'
A/app/data
Bdata
C/data
Dmydata
Attempts:
3 left
💡 Hint
Common Mistakes
Using volume name instead of host path.
Omitting the leading slash.
4fill in blank
hard

Fill both blanks to create a volume and then run a container mounting it at '/data'.

Docker
docker volume [1] myvol && docker run -v [2]:/data alpine
Drag options to blanks, or click blank then click option'
Acreate
Bmyvol
Cmyvolume
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'create'.
Mismatch between volume name in create and run commands.
5fill in blank
hard

Fill all three blanks to define a Docker Compose volume and mount it to '/var/lib/mysql' in the service.

Docker
version: '3.8'
services:
  db:
    image: mysql
    volumes:
      - [1]:/var/lib/mysql
volumes:
  [2]:
    [3]: local
Drag options to blanks, or click blank then click option'
Adbdata
Cdriver
Dlocal
Attempts:
3 left
💡 Hint
Common Mistakes
Using different volume names in service and volumes.
Omitting the driver key or using wrong value.