This is my first question, hope this meets the etiquette. My problem is as follows: when I create a volume, the volume is emptied (though not removed) as soon as the last container using it shuts down. For instance:
$ docker volume create \ --driver local \ --opt type=tmpfs \ --opt device=tmpfs \ --opt o=size=10G \ test $ docker run --rm -ti -v test:/test /bin/bash # here I can write to the volume $ # in another terminal $ docker run --rm -ti -v test:/test /bin/bash # here I can see the same files as in the first volume $ # now I Ctrl+C both commands above $ docker run -ti -v test:/test /bin/bash # /test is empty again, all changes made above have disappeared
The volume is still present in
docker volume ls, but if I inspect it and
ls its mount point on the host, it is empty. Why does the volume get emptied when the last container shuts down, and what can I do to prevent that?