Docker Flashcards

1
Q

What is the Docker command to run a container?

A

docker run image

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

docker run -d image

A

Runs the container in detached mode (in the background)

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

docker run -p 80:80 image

A

Map port 80 of the host to port 80 in the container

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

How to make…

docker run -d -p image

…more compact?

A

docker run -dp image

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

What is a container?

A

A process on the host machine that has been isolated from all other processes of the host machine

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

What does the process isolation leverages?

A

the kernel namespaces and cgroups

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

docker ps

A

List running containers

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

When running a container, it uses an _____ filesystem.

A

isolated

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

The isolated filesystem that a running container uses is provided by…

A

a container image

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

Since the image contains the container’s filesystem, it must contain…

A

everything needed to run an application - all dependencies, configuration, scripts, binaries, etc.

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

What is chroot?

A

?

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

In order to build our application, we need to use a…

A

Dockerfile

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

A Dockerfile is a…

A

text-based script of instructions that is used to create a container image

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

The CMD directive specifies…

A

the default command to run when starting a container from this image

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

The FROM instructions initializes…

A

a new build stage and sets the Base Image for subsequent instructions

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

The WORKDIR instruction sets…

A

the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile

17
Q

The COPY instruction copies…

COPY src dest

A

new files or directories from src and adds them to the filesystem of the container at the path dest

18
Q

What does the -t flag does?

A

It tags our image

19
Q

Command to stop a running container:

A

docker stop

20
Q

Command to remove a container that has stopped:

A

docker rm

21
Q

What does the -f do in that context:

docker rm -f

A

It removes the container even if it is running

22
Q

How do we tag an image?

A

docker tag imageName newImageName

23
Q

How do we remove an image?

A

docker rmi imageId