0
0
Dockerdevops~10 mins

Copying files to and from containers in Docker - Interactive Code Practice

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

Complete the command to copy a file named app.log from your local machine to a running container named webapp.

Docker
docker cp app.log [1]:/var/log/
Drag options to blanks, or click blank then click option'
Awebapp:/var/log
Bwebapp
Cwebapp:/app
Dwebapp:/home
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to include the colon between container name and path.
Using only the container name without the destination path.
2fill in blank
medium

Complete the command to copy a file named config.yaml from a container named db to your local directory /configs.

Docker
docker cp [1]:/etc/config.yaml /configs/
Drag options to blanks, or click blank then click option'
Adb
Bdb:/etc/config.yaml
Cdb:/etc
Ddb:/config.yaml
Attempts:
3 left
💡 Hint
Common Mistakes
Specifying only the container name without the file path.
Using a directory path instead of the full file path.
3fill in blank
hard

Fix the error in the command that tries to copy data.csv from the container analytics to the current directory.

Docker
docker cp analytics[1]data.csv .
Drag options to blanks, or click blank then click option'
A:
B/
C:/
D::
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the colon.
Using double colons or no slash after colon.
4fill in blank
hard

Fill both blanks to copy the entire directory /app/data from the container backend to the local directory ./backup.

Docker
docker cp [1] [2]
Drag options to blanks, or click blank then click option'
Abackend:/app/data
B./backup
C/backup
Dbackend:/backup
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping source and destination.
Using incorrect paths or missing colon.
5fill in blank
hard

Fill all three blanks to copy the file settings.json from the local directory ./configs to the container frontend inside the path /usr/src/app/config.

Docker
docker cp [1]/[2] [3]:/usr/src/app/config/
Drag options to blanks, or click blank then click option'
A./configs
Bsettings.json
Cfrontend
D/usr/src/app
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up container name and local path.
Forgetting to include the file name in the source path.