Your YAML file has some issues:
- You cannot use
network = hostbecause WordPress uses TCP port 80, which conflicts with the QTS system. We recommend using a different port or using bridging to obtain a different IP address. - Your WordPress should not use
127.0.0.1when connecting to MariaDB; you can use their Docker names. - Since files need to be uncompressed to the docker volume space , you can add
:zto the end ofvolumes.
You can refer to my YAML file below, and then you can access your WordPress via http://nas_ip:12345
services:
mariadb:
image: mariadb:latest
container_name: mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=REDACTED_PASSWORD
- MYSQL_DATABASE=wpdb
- MYSQL_USER=wpuser
- MYSQL_PASSWORD=REDACTED_PASSWORD
volumes:
- mariadb_data:/var/lib/mysql
wordpress:
image: wordpress:latest
container_name: wordpress
restart: always
ports:
- "12345:80"
depends_on:
- mariadb
environment:
- WORDPRESS_DB_HOST=mariadb:3306
- WORDPRESS_DB_NAME=wpdb
- WORDPRESS_DB_USER=wpuser
- WORDPRESS_DB_PASSWORD=REDACTED_PASSWORD
volumes:
- wordpress_data:/var/www/html:z
volumes:
mariadb_data:
wordpress_data: