Installation

I haven’t set up a new WordPress instance for quite some time. But lately I wanted to run WordPress on a Rasperry Pi. I used a docker compose file to run all services is one shot with

  • WordPress
  • Mariadb and
  • phpmyadmin.

Unfortunately the official mariadb image does not support ARM which is needed by the Raspberry Pi, so Im using jsurf/rpi-mariadb instead.

Here is the docker-compose.yml file:

version: '3.6'

services:
  wordpress:
    image: wordpress:5.7.2
    ports:
      - 80:80
    environment:
      - "WORDPRESS_DB_USER=root"
      - "WORDPRESS_DB_PASSWORD=vFvpKjJ7HUbkD3wyLDp4"
    restart: always
    dns: 8.8.8.8
    volumes: 
      - /srv/wordpress:/var/www/html

  mysql:
    image: jsurf/rpi-mariadb
    volumes:
    - /srv/wordpress-mysql:/var/lib/mysql
    environment:
    - "MYSQL_ROOT_PASSWORD=vFvpKjJ7HUbkD3wyLDp4"
    - "MYSQL_DATABASE=wordpress"
    restart: always

  phpmyadmin:
    image: phpmyadmin:apache
    environment:
     - PMA_ARBITRARY=1
    restart: always
    ports:
     - 9999:80
    volumes:
     - /sessions

You start the solution with docker-compose up -d. Now you can set up WordPress by connecting to it with “http://your-hostname:80”

To access phpmyadmin on port 9999 you need to use

  • Server: mysql
  • User: root
  • Password: vFvpKjJ7HUbkD3wyLDp4

Upgrades

I am usually relying on the built-in mechanism of WordPress to upgrade the WordPress Release, the Plugins and the Themes, but I think it would be good practise to run a docker pull wordress to make sure that we get the latest version of the whole technology stack (e.g. PHP) after each major release upgrade.


7 Comments

Jax · 16. February 2023 at 10:01

Thanks!

Javad · 23. May 2022 at 16:51

It worked for me! thanks! I do have one question though. How can I go about adding PHP extensions to the docker-compose file? In order to get the full functionality of WordPress to work, I need the PHP extension called ‘Intl’. How can I add this extension to the build?

    pschatzmann · 25. May 2022 at 12:38

    You would really need to create your own adapted image based on the standard image where you replace the php.ini file with your own version.

Gerhard · 14. November 2021 at 18:20

I have done everything as described in the instructions. when calling phpmyAdmin I get an error message.
Y
ou have been automatically logged out due to inactivity of 1440 seconds. Once you log in again, you should be able to resume the work where you left off.

does not know what to do.

thanks for the feedback in advance

Khir · 16. October 2021 at 12:30

Thanks You Very Match :)))

bleepPoo · 12. October 2021 at 16:46

To put it simply: this dit not work. I get this mysql:
“`
[Warning] Aborted connection 9 to db: ‘wordpress’ user: ‘root’ host: ‘172.25.0.2’ (Got an error reading communication packets)“`

Also, why is there the dns: 8.8.8.8 ? Is it needed if I just want to run it on my local network?

    pschatzmann · 13. October 2021 at 0:42

    I tested this again with the latest versions and you are right, it is not working any more. The installation of the latest WordPress release seems to be broken and I needed to use image: wordpress:5.7.2 to make it work again.

    I added the dns just to be on the safe side. I did some tests w/o it and e.g the release upgrade was working just fine…

    ps. to retry the installation, just delete the /srv/wordpress and/srv/wordpress-mysql directories

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *