When to use auto mapped Docker data volume

What is the main purpose of Docker data volume created by -v option without specified host file? For example docker run -v /data -ti my-image. Doc says it creates a new filesystem mapped to host filesystem to persist data (at some random-ish location). I understand that. But containers also persist all data when they are stopped and started again. So what is the difference between persisted data in stopped container vs. data volume?

I understand use-case for its advanced usage to map specific host file with -v /data:/data/host.

  • Creating a container that runs IBM Containers Extension (ICE)
  • Docker - invalid sharing of index.html Nginx file
  • Linux Docker and the underlying caching, nscd, hosts
  • No connection to generic driver
  • Add host mapping to /etc/hosts in Kubernetes
  • Are there characters that I need to escape in the ProcessStartInfo.Arguments?
  • How to use the latest Dart unstable in a Dockerfile?
  • Connecting IBM Containers (Dockers) to Watson IoT service instance
  • Issue withDocker Selenium Grid on VM
  • Mounting a directory to docker container
  • Dockerize Spring Boot Java app with Kafka, Zookeeper, and MongoDB [closed]
  • Docker, install postgresql in a container contain “ubuntu:14.04”, lost when out of the container
  • One Solution collect form web for “When to use auto mapped Docker data volume”

    Off the top of my head:

    1. If you are planning on using docker commit at some point, then an ephemeral volume like that can be used to intentionally prevent some contents from getting committed to the new filesystem image (because the contents of volumes are not preserved as part of the image).

    2. If you will be generating a lot of temporary data and you are worried about filling up the root container filesystem, using a volume will give you more space (because your data won’t be sharing space with operating system files).

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.