Skip to content

Sharing Windows folders with Docker containers

Docker containers are completely isolated from its Windows host system. So when you delete a container, all the changes you made to that container are also removed. If you want to have configuration files or other assets remain persistent, mounting Windows folders on your docker containers is a solution.

  • Note: Tests below are running in a Cygwin Window!
  • This allows us to have an optiomal Linux/Windows integration without any Virtualization like WSL2 or Virtualbox.

Invoke Cygwin bash and start docker container

  • Windows directory is mapped by –v parameter
  • Linux mount point : /import
  • Mapped Windows direcorty is: d:/dev/quarkus/security-keycloak-authorization-quickstart/import
Start as Cygwin bash
d:\dev\Quarkus\first-jpa-sample>bash

Check the Dirctory content 
$ dir d:/dev/quarkus/security-keycloak-authorization-quickstart/import
  realm-export.json

Start an Ubuntu bash via Docke by mounting the volumne ( see -v ) 
$ docker run -it -v "d:/dev/quarkus/security-keycloak-authorization-quickstart/import:/import" ubuntu /bin/bash

Validate directory content 
root@cac52549e307:/# ls -l /import
   -rwxr-xr-x 1 root root 75534 Jan 22 10:38 realm-export.json

Validate mount point 
# mount | grep import
  grpcfuse on /import type fuse.grpcfuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)

During docker Startup you may see following Popup Window

  • Just push Share it Button to start the Ubuntu container

Validate File Sharing Resources

Reference

Published inAllgemein

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *