
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"
-
Facing issues? Have Questions? Post them here! I am happy to answer!
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:
- Jupyter: Safari Cant Connect to the Server localhost:8888/tree - Python
- What version of windows do I have? - Microsoft
- Simple Crossword Puzzle example using Pure HTML, CSS and JavaScript - Html
- How to install AWS Toolkit for Visual Studio Code - AWS
- Emulator: Warning: restoring GLES1 context from snapshot. App may need reloading. - Android-Studio
- How to comment code in Python - Python
- Where are Notepad++ macros stored? - NotepadPlusPlus
- How to display Line Number in Eclipse IDE - Eclipse