Command

Docker Copy a File to or from a Container Command

The Docker command to copy a file to or from a container is docker cp SOURCE CONTAINER:DESTINATION.

Quick Answer

Command
docker cp SOURCE CONTAINER:DESTINATION
DockerCommand

Copy a File to or from a Container

Type this command
docker cp SOURCE CONTAINER:DESTINATION

Moves a file between your machine and a container.

Learn More

How to copy a file to or from a container in Docker

  1. Open the terminal or command interface for Docker.
  2. Type docker cp SOURCE CONTAINER:DESTINATION, replace any placeholders, and run it.

Docker Copy a File to or from a Container Command

Run docker cp SOURCE CONTAINER:DESTINATION.

Related Commands

Frequently asked questions

What is the Docker command to copy a file to or from a container?

Run docker cp SOURCE CONTAINER:DESTINATION.

Where do I type this Docker command?

Type it in the terminal or command-line interface used by Docker.

Does this Docker command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify