Docker database files: inside or outside the container?

We looked at implementing an Oracle Database using Docker on our server and are considering two different strategies for managing our data:

  • Saving the database files (.dbfs) in a folder on the server path, and then creating that folder in the container using the -v option. The idea is for multiple containers to access multiple folders so that we can manage different versions of our data.
  • Saving the database files inside the container as if it were a normal installation.

This is because we like the idea of ​​changing versions on the fly when we need to go back to an older version of our program to fix a bug (for example, if an older version is in production, the one we are currently working on). In this sense, the containers we have must also have a specific version of our application (this is a web application) in them.

So my question is this: which approach would be the best in our case? Is there any other organization of our containers that we missed and would be better? Look for more opinions on this matter. We've already been told that the first method will perform better than keeping everything in containers, but our tests showed no improvement.

Thank!

+3


source to share


1 answer


Go with the first parameter and forget the second, because you don't want to do heavy disk access on the Docker layered filesystem.

Docker containers have a layered filesystem that doesn't deliver great results. This is why you must have your data on the volume, which is ultimately the mount point in a folder in your docker host filesystem.



If you look at all the official docker images for databases, they all declare volumes for data. See MySQL , Postgres

+1


source







All Articles