DEV Community

Umesh Kumar Dhakar
Umesh Kumar Dhakar

Posted on

2 2

Share file between Host System and Docker Container.

1. Create a folder in Host System.
C:\\<directory-name>
(eg. C:\\Tunnel)

2. Add this folder in Shared Folder list of VM.
Go to : Machine > Settings > Shared Folder
(Add folder here.)

3. Create folder in VM.
mkdir /<directory-name>
(eg. mkdir /vm_tunnel)

4. Mount Shared Folder in VM directory.
mount -t vboxsf <host-directory-name> /<vm-directory-name>
(eg. mount -t vboxsf Tunnel /vm_tunnel)

5. Test sharing by creating file in Tunnel or /vm_tunnel and check in
/vm_tunnel or Tunnel.

6. Share file between Host and Conatiner.
docker cp <container>:/path/to/file/in/container /path/of/vm-direcory/where/host-folder/is/mounted
(eg. docker cp foo:/data/bar.txt /vm_tunnel/)

Thanks for reading! 😊

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay