Docker Community Forums

Share and learn in the Docker community.

Windows containers and volumes


(Petrjahoda) #1

Issue type: Windows Containers, persistent storage
OS Version, build: Windows 10, Docker Desktop 2.0.0.2
App version: 18.09

Hello everyone, we are using Docker with Linux containers in production for over a year and I spent last month creating windows containers of all our software.
By now I have it all OK and running with one exception.

When using Linux containers, I am using volumes as a permanent storage for data.
For example: I have a Linux container running MariaDB and DATA (where all data is stored) mounted as a volume. When I docker-compose down all the system and the docker-compose up the system, I have all the data. No problem.

When using Windows containers I am not able to achieve the same functionality. When I use volumes (for example that DATA directory) it overwrites everything that was previously in the DATA directory (in the container) and the DATA directory is empty.

Does anyone achieve persistent storage ,lets say of complete c:\ with Windows Containers?

I tried everything and read everything I found and find this impossible for now.


(Petrjahoda) #2

Finally, I managed to get a workaround.
I wanted to run apache server with web on nanoserver.
And also to make folder with web as a volume, to be accessible from windows.

So I did this:

  • copy web to c:/src2 into image
  • of course updated httpd.conf with c:/src as document root
  • create a script that runs when container starts and that copied c:/src2 into c:/src
  • volume is pointing into c:/src

If I did it directly (dopying into src without that script at startup) the volume mounting always rewrites c:/src which appears blank.

No I got working container with web, created at container start and accessible from windows.
And what is best: when I stop and start the container, even when I docker-compose down and then docker-compose up, the web is still there, behaving like permanent storage - useful for my second container: mariadb


#3

Windows Server containers using process isolation are slightly different because they use the process identity within the container to access data, meaning that file ACLs are honored. The identity of the process running in the container tutuapp