Okay so first off when you say Apache you really mean httpd for the Apache web server.
You can use a Apache image from the docker registry as seen here
But how about not using a base image from the registry
using run yum install and a cmd line argument in the docker file
Or you can just use yum install and then add the command to start the Apache web server when the container starts by adding at the end of the docker run command as seen here
And the command to start the server has a few variations
/usr/sbin/httpd -D FOREGROUND
/usr/sbin/apachectl/ -k -start -D FOREGROUND
What’s the difference between apachectl and httpd?
Per chatGPT, apachectl is a command-line tool designed to help with the administration of the Apache HTTP Server. It provides a convenient interface for various tasks such as starting, stopping, and restarting the server. It often acts as a wrapper around the httpd command, providing additional functionality and options.
On the other hand, httpd is the actual executable file for the Apache HTTP Server. When you use apachectl to start or manage the server, it internally calls the httpd command.
In summary, apachectl is a higher-level command that assists with Apache server management, while httpd is the core executable responsible for running the server itself.
Or if running the command inside of the Dockerfile you use:
With the path and the flags individually wrapped in quotes