Docker Community Forums

Share and learn in the Docker community.

Httpd on centos 8 base image not able to install

Hi All,

I am learning the docker. One task is with me.

Task
Install httpd on cents 8 base image only.

I have created the image using centos base image then created the container, but I found httpd is not installing at all using the RUN commands. Tried multiple things but not getting installing in centos 8.
When I had created centos image/container and then using interactive session tried same so it was working but if same commands I kept in Dockerfile so that is not working.

Can any one please help me,
Thank You

below is my Dockerfile

FROM centos:latest
RUN yum update -y && yum install httpd -y
COPY index.html /var/www/html/
CMD ["/usr/sbin/httpd", “D”, “FOREGROUND”]
EXPOSE 80

What error does it give you?
Else you can just use the official image instead

Hello Martin,
When i did login in container and checked the package is installed or not, So it was not there.
I did google and found alternet not solution.

Tested and its working well now.