$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>customization - Multiple Wordpress sites with docker|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

customization - Multiple Wordpress sites with docker

matteradmin10PV0评论

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. Thank you. N.

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. Thank you. N.

Share Improve this question asked Oct 9, 2016 at 8:28 nirocknirock 511 silver badge3 bronze badges 1
  • Depends on the size of your DB and if each site is a multisite with more sites. If they all need to access the same data then sharing a database would be nice. But for perf, go with separate DBs. – jgraup Commented Nov 17, 2016 at 4:14
Add a comment  | 

3 Answers 3

Reset to default 2

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/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 =)

If you don't have resource problem then create a docker-compose file per WordPress with a MySQL container per WordPress. Apps will be isolated, if not you can have some problems if you use one MySQL db container for all sites

Post a comment

comment list (0)

  1. No comments so far