I need to set up a docker-compose with 2 virtual hosts using apache2 and install a moodle on one of those.
I’m pretty lost tbh, I know that i need mysql and php. I wonder if someone could give an orientation dockerfile of how to do that.
(using ubuntu:16.04)
ACT1
My dockerfile looks like this atm but it’s not working when I try to run the image:
" FROM ubuntu:16.04
MAINTAINER Carles Fitó “carles_fitonegre@iescarlesvallbona.cat”
RUN apt update && apt install -y
apache2
apache2-doc \
nano
php7.0-mysql
php7.0-curl
php7.0-json
php7.0-cgi
php7.0
libapache2-mod-php7.0
php7.0-mcrypt
wget
COPY moodle.conf /etc/apache2/sites-available/moodle.conf
COPY downloads.conf /etc/apache2/sites-available/downloads.conf
RUN mkdir /var/www/moodle
RUN mkdir /var/www/downloads
RUN chown www-data -R /var/www/downloads
RUN echo “Downloads” > /var/www/downloads/index.html
RUN chown www-data:www-data -R /var/www/moodle
RUN chown 755 -R /var/www/moodle
RUN wget https://download.moodle.org/moodle/moodle-latest.tgz
RUN tar xzvf moodle-latest.tgz -C /var/www/moodle
RUN a2ensite moodle.conf
EXPOSE 80
VOLUME ["/var/www/moodle","/var/log/apache2","/etc/php7/apache2/"]
CMD ["/usr/sbin/apache2ctl", “-p”, “FOREGROUND”] "
I get this Apache ERR:
" apache2: illegal option – p
Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]
[-C “directive”] [-c “directive”]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C “directive” : process directive before reading config files
-c “directive” : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
Action ‘-p FOREGROUND’ failed.
The Apache error log may have more information. "
ACT 2
FROM ubuntu:16.04
MAINTAINER Carles Fitó “carles_fitonegre@iescarlesvallbona.cat”
EXPOSE 80
RUN apt update && apt install -y
apache2
apache2-doc \
nano
php7.0-zip
php7.0-mysql
php7.0-curl
php7.0-json
php7.0-cgi
php7.0
libapache2-mod-php7.0
php7.0-mcrypt
wget
COPY moodle.conf /etc/apache2/sites-available/moodle.conf
COPY downloads.conf /etc/apache2/sites-available/downloads.conf
RUN mkdir /var/www/moodle
RUN mkdir /var/www/downloads
RUN chown www-data var/www/downloads/
RUN echo “Downloads” > /var/www/downloads/index.html
RUN chown www-data var/www/moodle/
RUN chown -R 755 /var/www/moodle
RUN wget https://download.moodle.org/moodle/moodle-latest.tgz
RUN tar xzvf moodle-latest.tgz -C /var/www/
RUN a2ensite moodle.conf
RUN a2ensite downloads.conf
RUN service apache2 restart
VOLUME ["/var/www/moodle","/var/log/apache2","/etc/php7/apache2/"]
CMD ["/usr/sbin/apache2ctl", “-D”, “FOREGROUND”]