Docker Community Forums

Share and learn in the Docker community.

[docker toolbox]: Volume mount data lost after machine restart

I’m using docker toolbox and started ubuntu:18.04 container with bind mount.

docker run -d -it -v /c/Users/AJINKYA/container_backup/:/testdir ubuntu:18.04
docker exec -it 7cd bash
root@7cdc3ceebfbc:/# cd testdir/
root@7cdc3ceebfbc:/testdir# touch file1 file2
root@7cdc3ceebfbc:/testdir# exit

Whenever I remove the container and spawn a new one using the same command, the data written by previous container persists and can be seen inside new container.

docker rm -f 7cd
docker run -d -it -v /c/Users/AJINKYA/container_backup/:/testdir ubuntu:18.04
02c114bea5766edfe80db8fae96182c8230928eea2ce3376e8129d02fd7ca544

docker exec -it 02 bash
root@02c114bea576:/#  ls testdir/
**file1  file2**

As you can see the two files created before removing container persisted and are visible in new container.

But when I restart the system, the data in the host directory is lost. When the container is started, the directory contents are empty.

OS Details/Configuration:
Windows 10 Home (Version 1903)
Docker Toolbox version: 19.03.1
Oracle Virtualbox version: 5.2.20

I tried to search the existing issues and found a potentially similar one here: https://github.com/docker/for-win/issues/938
In the issue mentioned in that link, the data in bind mount directory is lost, but it can be seen after manually restarting the container.
I tried that as well but no data is seen even after manually restarting container.

I need to know whether this is a known issue. If so, is there any workaround?