WordPress bitnami docker volume persistence

Lot’s of words, but they do make up a complete sentence. I recently downloaded the WordPress bitnami docker-compose.yaml file; https://github.com/bitnami/bitnami-docker-wordpress.

The yaml file initiates two docker containers, one for the wordpress installation and one for the mariadb database. By looking at the yaml file, the default configuration states that the volumes for both the wordpress installation and the mariadb database will persist on your local machine, outside of the containers. This is the complete yaml file;

version: '2'
services:
  mariadb:
    image: docker.io/bitnami/mariadb:10.3
    volumes:
      - 'mariadb_data:/bitnami/mariadb'
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_wordpress
      - MARIADB_DATABASE=bitnami_wordpress
  wordpress:
    image: docker.io/bitnami/wordpress:5
    ports:
      - '80:8080'
      - '443:8443'
    volumes:
      - 'wordpress_data:/bitnami/wordpress'
    depends_on:
      - mariadb
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - WORDPRESS_DATABASE_HOST=mariadb
      - WORDPRESS_DATABASE_PORT_NUMBER=3306
      - WORDPRESS_DATABASE_USER=bn_wordpress
      - WORDPRESS_DATABASE_NAME=bitnami_wordpress
volumes:
  mariadb_data:
    driver: local
  wordpress_data:
    driver: local

However, I didn’t get it to work straight away on my Mac. Even though it says volume the files which by default should persist (wp-config.php and wp-content folder) were not showing up. The fix was really easy. I changed;

‘wordpress_data:/bitnami/wordpress’

to;

./wordpress_data:/bitnami/wordpress

So try it out if you’ve got the same problem as I had.

Leave a Comment