Tag Volume on MariaDB Docker Image

Quick Tip

If you try the official MariaDB Docker image, you will find out their image is using a docker volume to store the datadir /var/lib/mysql files.
So if you are going to work in a container, it’s a good practice to assign a name to the volume where your database data is being saved.

For example I’m used to create my containers naming the volume like this:

docker run -d --name patomariadb -v patovoldb:/var/lib/mysql mariadb

and it’s easy to find it:

pato@patocontainer ~ $ docker volume ls
local               patovoldb

So remember to tag the volumes of your MariaDB containers for easier future reference when you may need to duplicate or save your data.