Skip to content
Home » Copy file from host VM to Docker container

Copy file from host VM to Docker container

To copy files from host VM to docker container, you can use the docker cp command with the right container Id or the container name. Follow the below command.

Syntax:

docker cp /source/file/path/ container_id:/target/path/on/container/

Example:

docker cp file.txt c8f704d4a342:/opt/geeks/

To copy the folder use docker cp -r instead to docker cp

Also Read:
How to use docker without sudo
How to list docker images by name and tag
How to list all docker images