Docker Flashcards

1
Q

10 dockerfile instructions

A

FROM ubi8/ubi:8.5 2

LABEL

MAINTAINER

RUN

EXPOSE

Workdir

ENV

ADD

COPY

VOLUME

USER

ENTRYPOINT

CMD

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

First line of a dockerfile

A

Comment that begins with hashtag

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

Declare the image that will be extended

A

FROM ubi8/ubi:8.5 2

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

Add metadata

A

LABEL KEY=VALUE

LABEL description=”This is a custom httpd”

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

Populate author field

A

MAINTAINER John Doe

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

builds a new image based on dockerfile

A

podman build -t NAME:TAG DIR

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

executes commands

A

RUN

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

indicates that the container listens on the specified network port

A

EXPOSE 80

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

define environment variables that are available in the container

A

ENV LogLevel “info”

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

copies files or folders from a local or remote source and adds them to the container’s file system

A

ADD http://someserver.com/filename.pdf /var/www/html

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

copies files from the working directory and adds them to the container’s file system

A

COPY ./src/ /var/www/html/

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

specifies the username or the UID to use when running the container image

A

USER apache

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

specifies the default command to execute when the image runs in a container.

A

ENTRYPOINT [“/usr/sbin/httpd”]

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

provides the default arguments for the ENTRYPOINT instruction

A

CMD [“-D”, “FOREGROUND”]

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

Diff between ADD and COPY

A

ADD instruction unpacks the archive as a directory to the destination folder. The COPY instruction does not have this functionality

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

List the volumes available.

A

podman volume ls

17
Q

which volume ID belongs to your container

A

podman inspect custom-advanced \
–format=”{{.Mounts}}”

18
Q

Determine the current user of a container

A

podman run registry.access.redhat.com/ubi9/ubi id

19
Q

mount /www directory on your host machine to /var/www/html inside the container with the read-only option

A

podman run -p 8080:8080 –volume /www:/var/www/html:ro \
registry.access.redhat.com/ubi8/httpd-24:latest

20
Q

create a new volume called http-data

A

podman volume create http-data

21
Q

mount a previously created volume into a container,

A

podman run -p 8080:8080 –volume http-data:/var/www/html \
registry.access.redhat.com/ubi8/httpd-24:latest