I am using Docker on my Windows machine and i want to copy a directory to another directory in my Windows host. I have a Maven project that does this on Windows using org.apache.commons.FileUtils library and it works just fine. I want to run this Maven project in my Docker container so that i can move files on my Windows via Docker.
When i tried doing it, it gave no error but there was no copy process either. Can i manage files on my host machine with Docker?
2
Answers
Most sensible anwwer: You should not want to do this.
If you are working in a Container, don’t have dependencies to the Host.
Having dependencies to the Host contradicts why Docker exists.
But if you insist: You can do this by mapping the directories of the Host inside the Docker Container via Volumes.
And then you can copy inside the Docker container.
You can follow this: Docker: How to live sync host folder with container folder?
And learn about docker volumes from here: https://docs.docker.com/storage/volumes/