ARTICLE AD BOX
Having trouble on Docker trying to install Moodle through php8.5.3-apache image.
Here is my Dockerfile :
FROM php:8.5.3-apache WORKDIR /var/www/html/ # COPY ./moodle.conf /etc/apache2/conf-available/moodle.conf to set up the Apache configuration for Moodle. This file should contain the necessary directives to serve the Moodle application correctly. COPY ./moodle_listener.conf /etc/apache2/moodle_listener.conf COPY ./moodle_listeners.conf /etc/apache2/sites-available/moodle_listeners.conf # Installe les dépendances RUN apt-get update && \ apt-get install -y --no-install-recommends \ git \ unzip \ libzip-dev \ libjpeg-dev \ libpng-dev \ libfreetype6-dev \ libpq-dev \ libicu-dev \ libxml2-dev \ libonig-dev && \ docker-php-ext-configure gd --with-freetype --with-jpeg && \ docker-php-ext-install -j$(nproc) zip gd pgsql pdo_pgsql intl soap # Clone Moodle 5.1+ et configure la structure RUN mkdir /var/www/html/moodle && \ cd /var/www/html/moodle && \ git clone -b MOODLE_501_STABLE git://git.moodle.org/moodle.git . && \ chown -R root /var/www/html/moodle/ && \ chmod -R 0755 /var/www/html/moodle/ # Create data directory RUN mkdir -p /var/www/html/moodledata && \ chown -R www-data:www-data /var/www/html/moodledata && \ chmod -R 0777 /var/www/html/moodledata # Ensure the default site is enabled RUN ln -sf /etc/apache2/sites-available/moodle_listeners.conf /etc/apache2/sites-enabled/ CMD ["apache2ctl", "-D", "FOREGROUND"] EXPOSE 8080Here is the moodle_listeners.conf :
<VirtualHost *:8080> Include /etc/apache2/moodle_listener.conf </VirtualHost>And the moodle_listener.conf is there, copied from the Moodle Code Restructure article.
This is the error code when I docker run -p 8080:8080 --name moodle_setup moodle5.1 :
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message [Tue Mar 03 14:21:37.735910 2026] [mpm_prefork:notice] [pid 8:tid 8] AH00163: Apache/2.4.66 (Debian) PHP/8.5.3 configured -- resuming normal operations [Tue Mar 03 14:21:37.735943 2026] [core:notice] [pid 8:tid 8] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'I try some things on the web but nothing concluant. Thanks for help. The repo is here.
03/03/2026 18:32 CET+1 EDIT
After following some links & consider advice, I did that things :
Remap all on :80 port COPY ./moodle_listeners.conf /etc/apache2/sites-available/000-default.conf to erase the apache 000-default.conf (but want to keep the main way to get a clean code.) Point the DocumentRoot to /var/www/html/moodle/public instead of /var/www/html/moodleFor the moment It works! Thanks!
