Docker Container with RedHat Linux, Apache and mod_ssl

Kinjal P Darji
1 min readMay 8, 2024

--

Recently I wanted to learn more on how to configure AEM Dispatcher on RedHat Linux. Being a windows user, for me Docker container was the best choice to try this out.

For this, I created a local Docker image that has Apache and mod_ssl installed.

Here is the docker file that can be used to create RedHat Linux image with Apache and mod_SSL that exposes 80 and 443 port numbers.

FROM registry.access.redhat.com/ubi8/ubi:latest
RUN yum -y update && \
yum -y install httpd && \
yum -y install mod_ssl

COPY localhost.key /etc/pki/tls/private/localhost.key
COPY localhost.crt /etc/pki/tls/certs/localhost.crt

EXPOSE 80
EXPOSE 443

RUN httpd -k start

The keys can be generated locally using below command.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt

To build the image below command can be used, from the folder where the Dockerfile is placed.

docker build -f Dockerfile -t apache-httpd2 .

While running the image (Container) from Docker Desktop on windows (Host machine), provide the port numbers to which the container port number should be mapped.

Now on your windows machine check

https://localhost:<<portmappedto443>>

and

http://localhost:<portmappedto80>>

I will discuss more on how to configure AEM Dispatcher with SSL on this docker container in my next blog.

--

--

Kinjal P Darji

Hi, I am an AEM architect and a certified AWS Developer — Associate.