0
0
Dockerdevops~10 mins

Named volumes for data sharing in Docker - Interactive Code Practice

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

Complete the code to create a named volume called 'data_volume'.

Docker
docker volume create [1]
Drag options to blanks, or click blank then click option'
Adata_volume
Bvolume1
Cshared_data
Dmy_volume
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different volume name than the one referenced later.
Forgetting to create the volume before using it.
2fill in blank
medium

Complete the code to run a container that mounts the named volume 'data_volume' at '/app/data'.

Docker
docker run -d -v [1]:/app/data alpine sleep 1000
Drag options to blanks, or click blank then click option'
Adata_volume
Bmy_volume
C/data_volume
Dvolume_data
Attempts:
3 left
💡 Hint
Common Mistakes
Adding a slash before the volume name, which is incorrect.
Using a volume name that was not created.
3fill in blank
hard

Fix the error in the command to mount the named volume 'data_volume' to '/data' inside the container.

Docker
docker run -d -v [1]:/data alpine sleep 1000
Drag options to blanks, or click blank then click option'
Adata_volume/
B/data_volume
Cdata_volume
Dvolume/data
Attempts:
3 left
💡 Hint
Common Mistakes
Adding slashes before or after the volume name.
Using an incorrect volume name format.
4fill in blank
hard

Fill both blanks to define a service in docker-compose that uses the named volume 'data_volume' mounted at '/data'.

Docker
version: '3.8'\nservices:\n  app:\n    image: alpine\n    volumes:\n      - [1]:[2]\nvolumes:\n  data_volume: {}
Drag options to blanks, or click blank then click option'
Adata_volume
B/data
C/app/data
Dmy_volume
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the volume name and mount path.
Using a different volume name than declared.
5fill in blank
hard

Fill all three blanks to create a docker-compose service that mounts 'data_volume' at '/data', runs 'sleep 1000', and declares the volume.

Docker
version: '3.8'\nservices:\n  worker:\n    image: alpine\n    command: [1]\n    volumes:\n      - [2]:[3]\nvolumes:\n  data_volume: {}
Drag options to blanks, or click blank then click option'
Asleep 1000
Bdata_volume
C/data
Dsleep
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sleep' without the duration.
Incorrect volume name or mount path.
Forgetting to declare the volume under 'volumes'.