I'm having trouble deploying a Wordpress install via Docker compose/Portainer. Every time I try to deploy the docker-compose I get the following error: Error establishing a database connection on the Wordpress install.
I believe there is a mistake somewhere in the docker-compose below as I have eliminated other possibilities. It seems the WP install cannot communicate with the database volume in the container.
Any help would be appreciated, thanks
System info:
OS: Ubuntu 21.04
System: Rpi4 64bit
Docker-compose version: 1.29.2
docker-compose:
version: "3.9"
services:
wordpress:
depends_on:
- db
image: wordpress:latest
container_name: wordpress
restart: unless-stopped
ports: # For inital setup
- "91:80"
security_opt:
- no-new-privileges:true
environment:
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: mbA2tU9RyA5r@U
WORDPRESS_DB_NAME: wordpress
volumes:
- sbabaya:/var/www/html
mariadb:
image: mariadb:latest
container_name: db
restart: always
environment:
MYSQL_ROOT_PASSWORD: mbA2tU9RyA5r@U
MYSQL_DATABASE: wordpress
volumes:
- "db:/var/lib/mysql"
logging:
driver: "json-file"
options:
max-size: "10Mb"
max-file: "5"
volumes:
wordpress:
db: