LMSouq
server-admin Open

How to start apache2 automatically in a ubuntu docker container?

RA
Rayhan Muktader
1 month ago
3 views
Problem Description
I am trying to create a Dockerfile that will start apache automatically. Nothing has worked. But If I log into the container and run `service apache2 start` it works. Why can I not run that command from my Dockerfile? FROM ubuntu # File Author / Maintainer MAINTAINER rmuktader # Update the repository sources list RUN apt-get update # Install and run apache RUN apt-get install -y apache2 && apt-get clean #ENTRYPOINT ["/usr/sbin/apache2", "-k", "start"] #ENV APACHE_RUN_USER www-data #ENV APACHE_RUN_GROUP www-data #ENV APACHE_LOG_DIR /var/log/apache2 EXPOSE 80 CMD service apache2 start

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base