Created
May 11, 2014 10:05
-
-
Save tcnksm/4381bbe7e8258c1f9e8d to your computer and use it in GitHub Desktop.
Dockerfile for apache container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:12.04 | |
RUN apt-get update | |
RUN apt-get install -y apache2 | |
ENV APACHE_RUN_USER www-data | |
ENV APACHE_RUN_GROUP www-data | |
ENV APACHE_LOG_DIR /var/log/apache2 | |
RUN echo 'Hello, docker' > /var/www/index.html | |
ENTRYPOINT ["/usr/sbin/apache2"] | |
CMD ["-D", "FOREGROUND"] |
For people looking into this in 2022. I would suggest using a more recent ubuntu. Here's my file:
FROM ubuntu:20.04
ENV CONTAINER_TIMEZONE="Europe/Brussels"
RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
RUN apt update && apt install -y apache2
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/www/html
RUN echo 'Hello, docker' > /var/www/index.html
ENTRYPOINT ["/usr/sbin/apache2"]
CMD ["-D", "FOREGROUND"]
For people looking into this in 2022. I would suggest using a more recent ubuntu. Here's my file:
FROM ubuntu:20.04 ENV CONTAINER_TIMEZONE="Europe/Brussels" RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone RUN apt update && apt install -y apache2 ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_RUN_DIR /var/www/html RUN echo 'Hello, docker' > /var/www/index.html ENTRYPOINT ["/usr/sbin/apache2"] CMD ["-D", "FOREGROUND"]
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y apache2
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/www/html
RUN echo 'Hello, docker' > /var/www/html/index.html
ENTRYPOINT ["/usr/sbin/apache2"]
CMD ["-D", "FOREGROUND"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what does this command do ?? (CMD ["-D", "FOREGROUND"])