Docker Community Forums

Share and learn in the Docker community.

Migrating from VMs to containers : a few questions on what must be a common scenario


(Ptournet) #1

Hi,

Starting to experiment with Docker in order to gain some knowledge for a future new software development which will involve a new architecture and a new release pardadigm (at least), I’ve decided to start by dusting off our current dev pipeline and migrating it from VMs to containers.

Ou current infrastructure is the following : 1 XenServer hosting 5VMs running on CentOS. 1VM offering en OpenVPN access and 4 VMs (vmX) built on the same following template : vmX contains 2 apps (Xy) each with its own embedded application server (Tomcat), its working directory (/var/Xy) and accessing its own MySQL database (dbXy).

The projected infrastructure will keep 1 XenServer (because we have other servers in a pool and don’t want to lose the ability to run VMs on any machine) hosting 1VM running on CentOS with the following containers : 1 with OpenVPN, 8 with the apps (Xy).

For the working directories, from what I understood, it would be best to create 8 data volumes (1 per app) each linked to a different app container. Am I right with this ?
But, i’m a little puzzled about the MySQL databases. As far as I can tell there are 4 possible choices :

  1. embed MySQL in the app container, so each app will continue to access its DB on localhost, needing no configuration (but we will probably need 2 volumes in this case, and I don’t know yet if it’s possible and it seems to defeat a little the purpose of containerization)

  2. 1 MySQL container handling all 8 databases (plus 1 data volume)

  3. 4 MySQL containers each handling 2 databases (like now in each VM) (plus 4 data volumes)

  4. 8 MySQL containers each handling only 1 database (plus 8 data volumes)

So, what are the best practises regarding databases ? And therefore, which choice should I make ?

Thanks for your time.