Onno Onno - 5 months ago 33
MySQL Question

Why is MariaDB data persistent in my Docker container? I don't have any volumes

I have a Docker container with MariaDB installed. I am not using any volumes.

[vagrant@devops ~]$ sudo docker volume ls
[vagrant@devops ~]$

Now something strange is happening. When I do
sudo docker stop
sudo docker start
the MariaDB data is still there. I expected this data to be lost.

Btw when I edit some file for example
I do see the expected behavior. Changes to this file are lost after restart.

How is it possible that MariaDB data is persistent without volumes? This shouldn't happen right?


docker stop does not remove a container, neither does docker start create a container.

docker run does create a new container from a image.

docker start starts a container which does exist but has been stopped before ( call it pause/resume if you like ). Thus for start/stop no volumes are required to keep the state persistent.

if you though do docker stop <name> && docker rm <name> and then docker start <name> you get and error, that the container does no longer exist - so now you need docker run <args> youimage