Lab Docker Images Q 5

Hi Team

============================================================
This is the question and Hint

============================================================

When a container is created using the image built with this Dockerfile, what is the command used to RUN the application inside it.

Inspect the Dockerfile in the webapp-color directory.

python app.py
docker run app
app.exe
pip install flask

Hint

Open the Dockerfile and look for ENTRYPOINT command

===================================================

This is the dockerfile output on left hand side

$ cat Dockerfile

FROM python:3.6
RUN pip install flask
COPY . /opt/
EXPOSE 8080
WORKDIR /opt
ENTRYPOINT [“python”, “app.py”]
$
$

==============================================

The right answer appears to be " pip install flask " which is stated after RUN command.

  1. Why this is not a right answer ?

  2. Why is the hint and checks of this questions says the answer is in the ‘ENTRYPOINT’ command ?
    The check also passed only for python app.py

waiting for your kind reply

with best regards
Pradeep Nehe

You have to understand the concept of “entrypoint”. Given entrypoint instructions will run whenenver you will create a new container from that image. Whatever you wrote in your ENTRYPOINT instruction. It will be run in the creation of application container. Actually RUN instruction used to install requirement packages while creating an image. RUN is like yum or dkpg or apt for Dockerfile. We have to write RUN to install any packages in docker image build time. Like RUN yum install curl wget —> Centos