August 2018
Intermediate to advanced
352 pages
12h 30m
English
Before we begin, the git repository https://github.com/docker-cookbook/apache2 has a Dockerfile to build an apache2 image, so clone the repository as shown in the following code:
$ git clone https://github.com/docker-cookbook/apache2.git
Now, go to the apache2 directory:
$ cd apache2
$ cat Dockerfile
FROM alpine:3.6
LABEL maintainer="Jeeva S. Chelladhurai <sjeeva@gmail.com>"
RUN apk add --no-cache apache2 && \
mkdir -p /run/apache2 && \
echo "<html><h1>Docker Cookbook</h1></html>" > \
/var/www/localhost/htdocs/index.html
EXPOSE 80
ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"]
Read now
Unlock full access