Dockerfile Flashcards

1
Q

What must a Dockerfile begin with

A

a docker image tag
FROM { image_name }
ex: FROM python:alpine3.10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to specify what the working directory should be

A

WORKDIR /app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Determine what files should be downloaded to the docker container

A

COPY
ex: COPY . /app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you make a port available to the outside world

A

EXPOSE
EX: EXPOSE 5000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you comment code

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the two forms for RUN

A
  1. RUN <command></command> (shell form)
    • ex: RUN echo ‘I know how to use docker!’
  2. RUN [“executable”, “param1”, “param2”] (exec form)
    • ex: RUN [ “sh”, “-c”, “echo $HOME” ]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly