I want to host multiple independent wordpress sites (4-10) on a rootserver. I want to host them using docker containers.
Now the Q: Is it better to run ONE mysqldb running all wordpress schemes for the multiple sites, or is ist better to run one mysql instance per wordpress.
Following Docker’s philosophy of “one application per container” you should have a database container for each WordPress instance. This way each database is isolated from the others. Should anything happen to one database it will not affect the others. Also, if you want to migrate or take down one website you only need to act upon its containers.
The official WordPress image is prepared to link to another container providing a database. Therefore you will have two containers per website: one for the WordPress files and another for the database. For the databases you might use the official MariaDB image.
The traffic for the several WordPress containers might then be distributed by a proxy container such as this one.
I saw something that may help you. Click here to see : http://donalfarrell.com/2015/08/11/Docker-Nginx-Multi-Wordpress.html
Basically you need to use reverse proxy to resolve this problem and you can use the ‘link‘ property do sync your web application with specific database container. Nginx container to do reverse proxy, may be a good solution for you.
I hope it helps =)