W
W
Wicu2019-04-06 21:31:33
Docker
Wicu, 2019-04-06 21:31:33

Is it safe to store a database in volumes?

Is it safe to store Mysql DB in Docker volumes? There is an article on Google that says that doing this is strictly prohibited. What is the danger of storage in volumis?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2019-04-06
@sim3x

https://docs.docker.com/samples/library/mysql/#whe...

G
Georg Gaal, 2019-04-07
@gecube

First you need to understand that in order for the database not to disappear, it must be saved outside the container. Because the container is ephemeral, and its FS may disappear when the container is deleted. There are two ways to do this: volume and bind mount. The first saves data in a named or unnamed volume in the /var/lib/docker/volumes directory and there is a risk that it will be accidentally deleted (for example, with docker-compose down -v ). The second method allows you to store data outside the container in the file system of the host machine. It's more reliable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question