ETExamTower
Q9Application Deployment and Security

Refer to the exhibit. Drag the Dockerfile parts from the left to the numbered items that correspond to the missing sections, completing a Dockerfile that successfully builds and deploys a container running a Python application. Not all Dockerfile parts are used. <DragDrop items={["ENV","CMD","RUN","COPY","VOLUME","FROM","WORKDIR","EXPOSE"]} slots={[{"answer":"FROM","id":"item1","label":"<item 1>"},{"answer":"COPY","id":"item2","label":"<item 2>"},{"answer":"RUN","id":"item3","label":"<item 3>"},{"answer":"EXPOSE","id":"item4","label":"<item 4>"},{"answer":"CMD","id":"item5","label":"<item 5>"}]} explanation={"FROM selects the Python Alpine base image. COPY . . copies the application into the image, RUN installs dependencies while building the image, EXPOSE 5001 declares the application port, and CMD [\"python\", \"app.py\"] defines the default process that starts when the container runs."} reuse={false} />

Question exhibit
← → navigate · a answer
Discussion · 13
44
Agree, the correct answer is: FROM python:3.6-alpine COPY . . RUN pip install -r requirements.txt EXPOSE 5001 CMD ["python", "app.py"]
8
You are wrong: FROM python3.6-alpine RUN pip install -r requirement.txt
4
The answer from the site is correct
3
The two . . mean copy from the client current directory to the home directory on the docker
2
FROM has to be the first command, but I'm not sure whether COPY is correct here
2
I agree, this is the correct answer
2
Yep, the correct answer is: FROM python:3.6-alpine COPY . . RUN pip install -r requirements.txt EXPOSE 5001 CMD ["python", "app.py"]
1
RUN and FROM, swap them
1
Item 2, it's not easy to see why COPY is used here. Nothing is being copied?
1
I think the three ... indicate some content, so COPY fits
1
## Dockerfiles ## - FROM - Chooses the base image used to begin the build process or can be set to scratch to build a totally new image - MAINTAINER - Lets you choose a name and email address for the image creator - RUN - Creates image layers and runs commands within a container - CMD - Runs a single command within a container. Only one can exist in a Dockerfile. - WORKDIR - Sets the path where the command defined with CMD is executed - ENTRYPOINT - Runs a default application every time a container is created with the image - LABEL - Gives a label to identify the created Docker image - ADD - Copies the files from the local host or remotely via a URL into the container's file system - ENV - Sets environment variables within the container - EXPOSE - Links a specific port for networking binding - USER - Sets the UID (or username) of the user that runs the container - VOLUME - Sets up a sharable directory that can be mapped to a local host directory - COPY - Copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.
1
The answer is correct: FROM python:3.6-alpine COPY . . RUN pip install -r requirements.txt EXPOSE 5001 CMD ["python", "app.py"]
1
at least the requirements.txt gets copied