Forrest logo
back to the docker tool

docker:container:copy-file

Copy a file from a Docker container to the current host
$ docker cp ${container_id}:${container_filepath} ${local_filepath}
try on your machine

This command copies a file from a Docker container to the local machine.

  • docker cp is the command to copy files between a local file system and a Docker container.
  • ${container_id} is the ID of the Docker container from which the file is being copied.
  • ${container_filepath} is the path to the file that is being copied inside the container.
  • ${local_filepath} is the path to the location where the file will be copied to on the local machine.
This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool