Search code examples
mysqldockermariadbvolume

Can I run two different mysql docker containers using a shared data volume?


Given hypothetical scenario:

  1. I have two different identical docker containers (say nginx proxy manager for example).
  2. Both docker containers run on separate host machines with a mounted NFS drive at path /mnt/data.
  3. Both docker containers define their mysql data directory as /mnt/data, which is mapped to the same point on the NFS mount.

What potential problems could there be if both applications are running at the same time?


Solution

  • No,MySQL and MariaDB (that nginx_proxy_manager documents, are not shared storage databases, and only might detect each others appearance.

    You probably can use a database instance shared between two nginx_proxy_manager instances. I don't know if both can share a database or two databases need to be created in the container.