version: '3.9'
services:
wordpress:
image: wordpress:latest
container_name: Test_Env_2-WordPress
hostname: test_env_2-wordpress
healthcheck:
test: curl -f http://localhost:80/ || exit 1
ports:
- 7512:80
depends_on:
db:
condition: service_started
redis:
condition: service_healthy
phpmyadmin:
condition: service_healthy
volumes:
- ./wordpress:/var/www/html:rw
environment:
WORDPRESS_DB_HOST: test_env_2-db
WORDPRESS_DB_USER: user
WORDPRESS_DB_PASSWORD: Bb123456789*
WORDPRESS_DB_NAME: test_env_2-db
restart: on-failure:5
db:
image: mariadb:latest
container_name: Test_Env_2-DB
security_opt:
- no-new-privileges:true
hostname: test_env_2-db
environment:
MYSQL_DATABASE: test_env_2-db
MYSQL_USER: user
MYSQL_PASSWORD: Bb123456789*
MYSQL_ROOT_PASSWORD: Aa123456789*
TZ: Asia/Taipei
volumes:
- ./db:/var/lib/mysql:rw
ports:
- 3312:3306
restart: on-failure:5
redis:
image: redis
hostname: test_env_2-redis
container_name: Test_Env_2-REDIS
user: 1026:100
healthcheck:
test: ["CMD-SHELL", "redis-cli ping || exit 1"]
volumes:
- ./redis:/data:rw
environment:
TZ: Asia/Taipei
restart: on-failure:5
phpmyadmin:
image: phpmyadmin
hostname: test_env_2-phpmyadmin
healthcheck:
test: curl -f http://localhost:80/ || exit 1
container_name: Test_Env_2-phpMyAdmin
ports:
- 2500:80
environment:
PMA_HOST: test_env_2-db
PMA_PORT: 3312
restart: on-failure:5
Appreciate the recommendation. Let me try it out.