1

Please see the code below from a docker compose file:

sql.data:
    image: microsoft/mssql-server-linux:2017-latest
    volumes:
      - mssql-server-linux-data:/var/opt/mssql/data

The code works exactly as expected i.e. the data outlives the application i.e. it is persistent.

Where exactly is this data stored on my Windows PC (Docker for Windows - Linux Containers). For example, if I wanted to ensure that the data files are backed up each night then where would I look. I have spent hours Googling this today and I have found no answer. I even read that these data files are not stored on the filesystem - surely they have to be stored on the file system.

w0051977
  • 15,099
  • 32
  • 152
  • 329

2 Answers2

0

Credit to: Locating data volumes in Docker Desktop (Windows)

As recommanded in the official documentation (https://docs.docker.com/storage/volumes/), you can use the following command to get the source :

$ docker inspect my-vol

Then you will get something like this :

[
    {
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my-vol/_data",
        "Name": "my-vol",
        "Options": {},
        "Scope": "local"
    }
]

Your volume directory is in the line Mountpoint or Source /var/lib/docker/volumes/my-vol/_data, and /var/lib/docker usually mounted in C:\Users\Public\Documents\Hyper-V\Virtual hard disks.

Jérôme
  • 978
  • 1
  • 9
  • 22
0

Linux containers in Windows are (typically) provided by single virtualized Linux container host for all the containers in use. You can examine the underlying virtual machine image in ~\Hyper-V\Virtual Hard Disks.


Windows containers in Windows use ephemeral storage thrown away when the instance is stopped. If you've saved data to an NTFS bind mount or named volume, you can read it from the mount source as-is.

The container's layers are stored in C:\ProgramData\docker and split across the image and windowsfilter directories. (This path is sourced from the registry under HKLM:SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Virtualization\LayerRootLocations)

You won't be able to mount and examine these layers as volumes however. The system files seen in-container are materialized by a filter driver which provides a virtual overlay of package layers onto the container volume, each directed to the backing package files by wcifs.sys.

zetavolt
  • 2,989
  • 1
  • 23
  • 33
  • so can I just specify a random directory structure e.g. - mssql-server-linux-data:/no/idea/where/to/put/this – w0051977 Apr 06 '20 at 20:38