How to run WordPress with Docker on a Raspberry Pi
Why would you do that?
The greatest advantage with this installation is that you can just play and fiddle around as you like and afterwards just clean it up by deleting the containers without leaving any residues of software. Having your Pi running 24/7 you could build a one pager to serve your portfolio or test your enthusiasm about blogging before going big. If you don’t have high traffic you can just run WordPress in parallel with other services on the Pi. Furthermore it is a resource friendly but capable computer costing only about under 10 € of electricity per year (source, 04.11.2019).
If you are only interested in the docker-compose file you can get a head start from my repository at https://gitlab.com/nm_hung93/dockerized-wordpress-on-raspberry-pi . If you are not entirely new to this you can skip ahead to chapter #1.
I once did an internship at a big e-commerce company and learned a lot about cloud computing and big data which i probably would not get in touch with at such a deep level with my educational background and technological understanding back then. The main takeaway for me was working with Linux based machines and i also learned about containerization with Docker. When i finished that internship i got a Raspberry Pi as a farewell gift. Now silly me always wanted to implement a website which shows a list of best strawberry milkshake bars in town and this would be the perfect opportunity to both make use of that Raspberry Pi and learn a little bit about containers.
And now you are actually looking at a website hosted on that said Raspberry Pi directly from my home, which might be why the loading time can be very slow some times (reason being my slow ISP).
This blog is running since March 2019 and I did use a pre-configured docker-compose which i found here at medium. Unfortunately the PHP version was a little bit outdated and running a dockerized WordPress site on a Raspberry Pi is unsurprisingly not too well documented on the Internet. That is how i decided to build my own images to attend my needs and while I’m at it I could also document this process in form of blog posts. It was just a matter of building new images and replacing them with the old one right? Well almost. In this series i will go through how i build my new images almost from scratch and some of the problems which occurred.
Please keep in mind that i am not the most tech savvy person and do this as a hobby. My explanations at some point might be a little bit too trivial and abstract. On the other hand i will try to explain some steps in greater detail. After all this is a post from a beginner to a beginner.