Metainformationen zur Seite
  •  

Dies ist eine alte Version des Dokuments!


Webtrees in einem docker container

How to Set Up Nginx, MariaDB, and PHP with Docker Compose

docker-compose.yaml

docker-compose.yaml
version: '3.8'
 
# Services
services:

    # PHP Service
    php:
        build:
            dockerfile: php-dockerfile
        volumes:
            - './php-files:/var/www/html'
        depends_on:
            - mariadb
 
    # Nginx Service
    nginx:
        image: nginx:latest
        ports:
            - 8087:80
        links:
            - 'php'
        volumes:
            - './php-files:/var/www/html'
            - './nginx-conf:/etc/nginx/conf.d'
        depends_on:
            - php
 
    # MariaDB Service
    mariadb:
        image: mariadb:10.9
        environment:
            MYSQL_ROOT_PASSWORD: uhpc49C5+#
        volumes:
            - mysqldata:/var/lib/mysql
 
    # phpMyAdmin Service
    phpmyadmin:
        image: phpmyadmin/phpmyadmin:latest
        ports:
            - 8082:80
        environment:
            PMA_HOST: mariadb
        depends_on:
            - mariadb
 
# Volumes
volumes:

  mysqldata:

php-dockerfile

php-dockerfile
FROM php:8.1-fpm

# Installing dependencies for the PHP modules
RUN apt-get update && \
    apt-get install -y zip libzip-dev libpng-dev

# Installing additional PHP modules
RUN docker-php-ext-install mysqli pdo pdo_mysql gd zip mbstring curl exif fileinfo gd intl

php-files/index.php

<?php phpinfo(); ?>