Recall & Review
beginner
What command copies files from your local machine to a Docker container?
Use
docker cp <local_path> <container_id>:<container_path> to copy files from your local machine to a container.Click to reveal answer
beginner
How do you copy files from a Docker container to your local machine?
Use
docker cp <container_id>:<container_path> <local_path> to copy files from a container to your local machine.Click to reveal answer
beginner
Can you copy directories using
docker cp?Yes,
docker cp supports copying entire directories between your local machine and containers.Click to reveal answer
intermediate
What happens if the destination path does not exist when copying files with
docker cp?Docker will create the destination directory if it does not exist when copying directories. For files, the parent directory must exist.
Click to reveal answer
intermediate
Is it possible to copy files between two running containers directly using
docker cp?No,
docker cp works only between your local machine and a container. To copy between containers, copy to local first, then to the other container.Click to reveal answer
Which command copies a file named
app.log from your local machine to the /var/log directory inside a container with ID abc123?✗ Incorrect
The correct command is
docker cp followed by the source and destination paths.To copy a directory named
data from a container xyz789 to your local machine, which command is correct?✗ Incorrect
Use
docker cp container_id:/path local_path to copy from container to local.What will happen if you try to copy a file to a container path that does not exist?
✗ Incorrect
Docker requires the parent directory to exist when copying files; otherwise, the command fails.
Can you use
docker cp to copy files directly between two running containers?✗ Incorrect
docker cp only works between local machine and a container.Which of these is NOT a valid use of
docker cp?✗ Incorrect
Direct copying between containers is not supported by
docker cp.Explain how to copy a file from your local machine into a running Docker container.
Think about source and destination order in the command.
You got /4 concepts.
Describe the steps to copy a directory from a Docker container to your local machine.
Remember the order: container path then local path.
You got /4 concepts.