docker compose mysql phpmyadmin php code example
Example: docker-compose phpmyadmin example
version: '3.8'
services:
db:
image: mariadb:latest
restart: always
healthcheck:
interval: 120ms
retries: 5
start_period: 60ms
test: |
touch /tmp/healthcheck.txt &&
mkdir /tmp/healthcheck &&
mv /tmp/healthcheck.txt /tmp/healthcheck &&
cd /tmp/healthcheck &&
echo "hello my docker container is working fine" >> healthcheck.txt &&
cat healthcheck.txt &&
rm healthcheck.txt &&
cd .. &&
rmdir /tmp/healthcheck
cls
timeout: 30ms
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_USER=root
- MYSQL_DATABASE=projectdb
ports:
- 3306:3306
volumes:
- mysql-data:/var/lib/mysql/data
networks:
- pma_networks
pma:
image: phpmyadmin:latest
restart: always
healthcheck:
interval: 120ms
retries: 5
start_period: 60ms
test: |
touch /tmp/healthcheck.txt &&
mkdir /tmp/healthcheck &&
mv /tmp/healthcheck.txt /tmp/healthcheck &&
cd /tmp/healthcheck &&
echo "hello my docker container is working fine" >> healthcheck.txt &&
cat healthcheck.txt &&
rm healthcheck.txt &&
cd .. &&
rmdir /tmp/healthcheck
cls
timeout: 30ms
environment:
- PMA_ARBITRARY=1
ports:
- 80:80
depends_on:
- db
volumes:
- pma-data:/var/lib/phpmyadmin/data
networks:
- pma_networks
volumes:
mysql-data:
pma-data:
networks:
pma_networks: