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: