Why data disappears
A container is meant to be replaceable. If you remove it, anything written only inside that container can go with it.
That is fine for code. It is bad for a database, uploaded images, SQLite files, or generated reports you need after a restart.
The core idea
Use a volume when data must outlive a container. The image gives the app its starting files; the volume keeps changing data outside the container lifecycle.