
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"
-
Have Questions? Post them here!
More Posts related to Docker,
- How to docker remove a container when it exits
- Install Python on Alpine Linux - Docker
- How to Rename Docker Image with none TAG and REPOSITORY?
- Remove all stopped containers in Docker using prune command
- [Fix] Docker Error response from daemon: manifest for :latest not found: manifest unknown
- [fix] Error response from daemon: conflict unable to remove repository reference ubuntu container is using its referenced image
- [Docker] Install Python3 on Alpine Linux
- Unable to find image docker latest locally
- How to Stop/Cancel/kill docker image pull
- How to know the Docker Engine Version
- [fix] Docker: OCI runtime exec failed unable to start container process
- [Solution] Alpine Docker apt-get: not found
- Install and Run Cassandra on Docker Desktop
- Install node on Alpine Linux Docker
- How to Copy files from Docker Container to Host System
- Install the minimal Linux on Docker (only 5 mb Alpine Linux)
- How to stop and start a docker container
- Docker - Error response from daemon: You cannot remove a running container
- Open Docker Desktop from macOS Terminal
- How to check installed docker version command
- How to know the Docker Sandbox ID of a Container Network?
- [fix] docker: Error response from daemon: dial unix docker.raw.sock: connect: no such file or directory.
- [Docker] Install Git on Alpine Linux
- Docker MySQL Compose File with Volume Example
- [fix] Docker: Alpine Linux - /bin/sh: bash: not found
More Posts:
- Android Studio Error:(19, 0) Gradle DSL method not found: android() - Android-Studio
- How to get end of line (EOL) or new line character \r \n in Java - Java
- How to Update Microsoft Teams to the latest Version - Teams
- How to lock Notepad++ tabs? - NotepadPlusPlus
- Fix - 412 Cookies Are Disabled error in Exchange Admin Center when you click hybrid - Microsoft
- Mac turn dark mode on or off using terminal command - MacOS
- Enable and reduce background noise in Microsoft Teams with AI-based noise suppression - Teams
- How to connect to SFTP location using Terminal command - FTP