I have created a docker file and while i am building and runing the container the container exits immediately.
I am using Ubuntu 18.04 as the base OS on which docker is installed.
My docker file contains the following
FROM ubuntu <br>
RUN apt-get update <br>
RUN apt-get install apache2 -y <br>
RUN apt-get install apache2-utils -y <br>
RUN apt-get clean <br>
RUN rm -rf /var/lib/apt/lists/* <br>
EXPOSE 80 <br>
ENTRYPOINT ["apache2ctl"] <br>
CMD ["/usr/sbin/apache2ctl", "-DFOREGROUND"] <br>
Command Used to build the image is :
sudo docker build -t myimage .
Command user to Run the Container is :
sudo docker run -it -p 80:80 myimage
Following output
sudo docker ps -a <br>
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS
NAMES 6b1891ac8195 myimage "apache2ctl /usr/sbi…"
15 minutes ago Exited (1) 15 minutes ago
infallible_williamson
dc3cc1328508 5b5570dec3a9
"tail -f /dev/null /…" 17 minutes ago Exited (1) 17 minutes ago stoic_ganguly
a67f5cb9f080 53a1c1ddc4fc "tail -f /dev/null /…" 18 minutes ago Exited (1) 18 minutes ago
vibrant_grothendieck
07fa216c6c00 b5d19c3240f7
"apache2ctl /usr/sbi…" 31 minutes ago Exited (1) 31 minutes ago keen_blackburn
71d686cb0b8e 568c96482f1c
"apache2ctl /bin/sh …" 39 minutes ago Exited (1) 38 minutes ago happy_saha
11e0abe7c2ec d056b6f1d824 "apache2ctl /bin/sh …" 40 minutes ago Exited (1) 40 minutes ago
vibrant_kare
17ed24e8eef4 d056b6f1d824 "apache2ctl /bin/sh …" 3 hours ago Exited (1) 3 hours ago
gallant_dijkstra
b1c6d9bf2765 d056b6f1d824
"apache2ctl /bin/sh …" 3 hours ago Exited (1) 3 hours ago
elated_joliot
Please help.
