Write a Docker File task marked failed

Dear @Inderpreet @kodekloud-support3,

How come the validation is telling me the port 5000 is not exposed? :face_with_raised_eyebrow:

you have to write 80 instead of 5000. Because 5000 is a host system port not a apache port. Might be you wrote according to task but my overview according to failed task description.

I think the host port notion would come in if I was told to create a container from this image but I am only told to create a Dockerfile @player001, my friend. How would you configure the Apache to listen on TCP port 5000? How would your configuration for Dockerfile look like?

Actually i just shared my views. Because what is task i don’t know.

Thanks man @player001. The task was asking to setup a Dockerfile for Apache2 and expose port 5000.

In Ubuntu, we don’t need to start service of apache2?
If yes, then you haven’t declare CMD or ENTRYPOINT to start default apache2 service. If service term exist in Ubuntu. Because i am not a Ubuntu user so just asking this questions.


CMD is for declaring a command that will run when you create a container from the image. It was not necessary on this task. :slightly_smiling_face:

Hi @Inderpreet @KodeKloud @kodekloud-support3,

Can some please reply to what is wrong with my Dockerfile? I have exposed the port 5000 on the Dockerfile is asked from the task. Please.

The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. It does not configure Apache2 to run under such port.
You have to change port in apache2 config eg.
sed -i ‘s/80/5000/’ /etc/apache2/ports.conf

1 Like

Thanks, I really appreciate it.

Do not forget to start apache2 :slight_smile: this is as well missing

Sure, will do @andrzej:sweat_smile:

@KodeKloud @Inderpreet

can you take a look why my configuration failed?



FROM ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y
RUN apt-get install apache2 -y
RUN sed -i ‘s/80/3003/’ /etc/apache2/ports.conf

ENTRYPOINT ["/usr/sbin/apache2ctl"]
CMD ["-D",“FOREGROUND”,"-k",“start”]

Have you tested with curl command?

Because in your dockerfile double quotes is not okay. A few is a block quotes.

curl command shows good

this link said single quote not ok, has to be double quote for avoiding debugging nightmare :frowning:

I am not again double quotes, In your mention dockerfile a few double quotes looks like block quotes.

I have enrolled @mmumshad several course on Udemy, except the docker course, but from the course detail, no docker file section. :frowning: in the Kubernetes course, he briefly touched on docker. Anyone point me to where can i get some info for dockerfile format?

@player001 thank you for your help. just lately a little frustrated on failing tasks and unsure the reason. and didn’t find out what went wrong. I was sure that I solve the problems then submit, but FAILED jumped at you, don’t feel good. :slightly_frowning_face: