Wordpress YAML that allows easy management in the future

I need a wordpress/mariadb/adminer yaml where all volumns are named properly so that I can easily get the the wp-config.php file as well as the PHP.ini file as there are always changes needed and I can never find the correct files as the volumes get random names and I can never find the php.ini file.

I’m using a QNAP nas sever and have already got several wordpress sites working, but without adminer, it’s luck if I can find the wp-config file, and never see the correct php.ini (i have 7 docker websites set up, when I search for php.ini I find 19!)

Here’s the yaml I use.

version: '3'

    # We use a mariadb image which supports both amd64 & arm64 architecture
    image: mariadb:10.6.4-focal
    # If you really want to use MySQL, uncomment the following line
    #image: mysql:8.0.27
    command: '--default-authentication-plugin=mysql_native_password'
      - ./db_data:/var/lib/mysql
    restart: always
      - MYSQL_DATABASE=portfolio
      - MYSQL_USER=hhhadmin
      - MYSQL_PASSWORD=xxxxx
      - 3306
      - 33060
    image: wordpress:latest
      - 8110:80
    restart: always
      - WORDPRESS_DB_USER=xxxx
      - WORDPRESS_DB_NAME=portfolio

I’m very inexperienced with Docker, and not a UNIX guy, but can follow instructions if needed

Many thanks

As I’m not entirely sure what your question is, I assume you want to learn how you could use named volumes instead of anonymous (randomly named) volumes. You already used a bind mount in the mysql container, which would be needed to mount a php ini file. I wrote about several ways here: Everything about Docker volumes - DEV Community

By using a bind mount, you can mount a single file, not just a folder.

Thanks for your reply, sorry if I wasn’t clear. I’ll read yout article and get back with any questions if that’s ok.


Having read through the article, I’m sorry to say that I still do not see how to configure the yaml file to allow access to the PHP.ini file.

I thought I needed to add - ./php.ini:/usr/local/etc/php/php.ini into the volumes section of the wordpress service, but I still cannot find the file on my qnap nas server

Don’t just read, try, in order to learn. You have to have the file on the host. It wont copy or mount from the container. It mounts into the container as mention in the blogspost as well

Edit only source code that you mount into the container during development