Why non persistant datas became persistants

Hello,

I’m new in docker. My first docker is cacti with this image : Docker Hub
I run this in docker desktop for windows under windows 10.
As describe, volumes have been created for 5 mount points.
But I try adding a file in a path that is not in persistant directory, and after a restart of the container, the file was still there. So I don’t understand why?

The persistante volumes of this container :
/opt/cacti/plugins
/var/log

/opt/cacti/templates

/var/lib/mysql

/opt/cacti/rra

The file I add:
/var/www/cacti/scripts/livebx.sh

So why the file is persisting and where is it saved?

Because the container is still the same, a container can handle a start/stop or a restart of the host, without loosing data.

When we talk persistant storage, its because if you ever need to update/move a container, you need to delete and create it again, you cant edit fx. ports on a existing container, so if you ever “docker rm CONTAINER”, the data is gone, unless you mounted a volume into the container, then the data is still there, in the volume, so the next time you use “docker run …” with the volume, the data is back.

Hope that makes sense :slight_smile:

Thank you for your replie.
I understand it’s ok.

Thank you for your replie. I understand.
Now I’ve an other question. My data persisting under the container until I don’t remove it. So now I’ve a look on the “containers” folder.
I’ve found my containers here :
\wsl$\docker-desktop-data\version-pack-data\community\docker\containers
And when I browse the container, I didn’t find the file I had created.
It is normally under /var/www/html/cacti/scripts/liveb.sh
There is “checkpoint” and “mounts” directory (empties), and some other files in the root directory. But where could be stored my file inside the container ?