
In this article, we will take a look at how to run an Apache2 HTTP Server on Alpine Linux and host a simple HTML page,
Dockerfile:
FROM alpine:latest
RUN apk add apache2
COPY index.html /var/www/localhost/htdocs
CMD ["sh"]
index.html
<html><body><h1>Hello from Alpine Linux running Apache2</h2></body></html>
Build the Dockerfile
% docker build -t alpine-apache-http .
[+] Building 0.1s (10/10) FINISHED
Running the Dockerfile
docker run -it -p 8080:80 alpine-apache-http sh
# /usr/sbin/httpd
AH00558: httpd: 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
/ # cd /var/www/localhost/htdocs
In order to start the apache2 server on Alpine Linux on Docker run the command "/usr/sbin/httpd"
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!