Dockerfile Flashcards
1
Q
What must a Dockerfile begin with
A
a docker image tag
FROM { image_name }
ex: FROM python:alpine3.10
2
Q
How to specify what the working directory should be
A
WORKDIR /app
3
Q
Determine what files should be downloaded to the docker container
A
COPY
ex: COPY . /app
4
Q
How do you make a port available to the outside world
A
EXPOSE
EX: EXPOSE 5000
5
Q
How to specifie the default program that will execute once the container runs
A
CMD
EX: CMD python ./launch.py
- This example executes a python file
6
Q
How do you comment code
A
#
7
Q
How do you execute command s in a new shell on top of the current image and commit the results. The resulting commited image will be used for the next step in the Dockerfile
A
RUN
8
Q
What are the two forms for RUN
A
- RUN <command></command> (shell form)
- ex: RUN echo ‘I know how to use docker!’
- RUN [“executable”, “param1”, “param2”] (exec form)
- ex: RUN [ “sh”, “-c”, “echo $HOME” ]