To copy a file or folder from the docker container to the host VM, you can use the below docker cp command with required arguments.
Syntax:
docker cp <containerId>:/path/of/file/within/container /path/on/host/target
Example:
sudo docker cp 4d4be5316e43:/file1.txt /home/geeks/
You can also use the initial part of container id or the container name as well.
Also Read:
Filter Docker images
Get Docker container’s IP address from the host
Remove All Stopped Docker Containers