Skip to content

Instantly share code, notes, and snippets.

@mekuls
Last active February 23, 2016 05:34
Show Gist options
  • Save mekuls/f159dc3fe82c787293c9 to your computer and use it in GitHub Desktop.
Save mekuls/f159dc3fe82c787293c9 to your computer and use it in GitHub Desktop.
Docker - Serving a static website using apache2
# I'm still not proficient with these commands so I'm putting them here
# Like training wheels... for the terminal
docker build --tag=blah
docker run -h myhost.com -p 8080:80 -d -i blah:latest
# Here's an example of mapping /var/www/html on the host machine to
/var/www/html in the guest container: (Note that the host path is on the left side of the ':')
docker run -h myhost.com -v /var/www/html:/var/www/html -p 8080:80 -d -i blah:latest
FROM ubuntu:trusty
MAINTAINER Luke Muccillo version: 0.1
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install apache2 -y
RUN DEBIAN_FRONTEND=noninteractive apt-get clean
RUN DEBIAN_FRONTEND=noninteractive rm -rf /var/lib/apt/lists/*
RUN mkdir $APACHE_LOCK_DIR
RUN chown $APACHE_RUN_USER $APACHE_LOCK_DIR
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment