How to Copy files in Docker Container

Overview

copy files from a local folder to docker container
docker cp localfolder/.  mycontainer:/test

this command will copy all the files and folders from localfolder to mycontainer's test folder.

To copy a single file you can mention the file name like this.

docker cp localfolder/myfile.txt mycontainer:/test
copy files from the container to a local folder
docker cp mycontainer:/test/myfile.txt localfolder