kerDoc Flashcards

1
Q

What is a Container?

A

A way to package applications with all the necessary dependencies and configuration they need

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

What is a Portable Artifact?

A

Easily shared and moved around

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

What is a benefit of Containers?

A

Makes development and deployment more efficient

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

Where do Containers live?

A

In storage, in a Container Repository

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

Is there a public repository for Docker?

A

Yes, DockerHub

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

What types of things are usually in a Container?

A

Code - Node, .NET, Python

Databases

Storage?

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

If a technology already exists, should you make your own Docker for it?

A

Only if you want a lot of customization. Thee is likely already an official Docker container for every tech out there

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

What is a benefit of Containers?

A

Every dev has to install all the tech they need on their pc, and configure them for their local environment

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

Are Containers cross platform?

A

Yes

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

Is a container its own isolated environment?

A

Yes

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

Do containers automatically update and upgrade any tech they contain?

A

No

You can pick which specific version you want to run, and it will never change

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

Can you run all the tech in a Docker with one line of code?

A

No, you have to run one each

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

You can only run one Docker at a time on a pc

A

False, you can run several, even several different versions of the same tech, e.g. Postgres 9.6, Postgres 10.17

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

Developers often work with which group of people on containers?

A

Operations

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

What environmental configurations are needed on server?

A

Only Docker Runtime

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

Containers contain layers of what?

A

images (software)

For example, the Linux Base Image

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

What Linux base image is often used in containers?

A

alpine

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

Where is the Application layer, usually?

A

Application image on top

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

What would you type in the terminal to get a Docker Container to pull postgres 9.6?

A

docker run postgres:9.6

When you tell Docker to run a container and it is not installed locally, Docker will download it and start it

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

What is an advantage of using Layers?

A

When a dev wants to update some tech in a container, Docker will only download the layers of that tech that have changed

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

How would you run a docker file for postgres9.6 and create a superuser password from the terminal?

A

docker run -e POSTGRES_PASSWORD = mypass

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

How would you check to see what all containers are running from the terminal?

A

docker ps

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

Explain the difference between a Docker Image and a Docker container

A

Docker Image - The actual package, all the code and tech. It is considered an artifact. It does not run

Docker Container - After you pull an Docker Image and start it in your local environment, a container environment is created. A Docker Container is something that is currently running

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

Where are Docker Images stored locally on Windows?

A

C:\ProgramData\DockerDesktop ???

/var/lib/docker is mounted on the persistent Virtual Disk of the VM which is under C:\Users\Public\Documents\Hyper-V\Virtual hard disks ???

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

What command can you run to see your local Docker configuration?

A

docker info

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

What 2 layers do OS’s have?

A

OS Kernel

Applications

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

What does an OS Kernel control?

A

Hardware

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

Is there a different Kernel for every distribution of Linux?

A

No. Only 1

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

What part of an OS does a Virtual Machine virtualize?

A

Applications layer and OS Kernel

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

What part of an OS does a Docker virtualize?

A

Applications layer

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

Does a Virtual Machine use a host kernel?

A

No, it spins up its own

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

Typically, are Docker Images or Virtual Machines smaller

A

Docker Images

Docker Images = MBs
Virtual Machine= GBs
typically

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

Does a Virtual Machine start faster than a DI?

A

no way

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

Can a Virtual Machine or a DI run any OS on any OS host?

A

Virtual Machine

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

What can you use to run a Linux DI on Windows

A

Docker Toolbox

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

What version of Windows and after do you not need to use Docker Toolbox?

A

Windows 10

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

Docker Quickstart Terminal?

A

it is

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

Does Docker use the local host’s file system?

A

No, it creates its own virtual file system

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

What command can you use to see all Docker Images you have on your pc?

A

docker images

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

If you don’t chose a specific version of Docker Image to pull, what happens?

A

You will pull the latest version

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

What is one way to stop a running Docker Container?

A

Ctrl+c

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

What is detach mode and how can you run it?

A

When you don’t run Docker in detach mode, when you run a container, the terminal becomes unusable and you have to open another terminal. Detach allows us to keep using the same terminal

docker -d postgres

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

If some part of your Docker container crashes and you need stop and restart the whole thing, how would you do that?

A

docker stop (Docker Image ID)

docker start (Docker Image ID)

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

How can you get a list of all Docker containers running and not running?

A

docker ps -a

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

Create binding between a port that your host machine has and the container

A

yep

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

If you are running 2 Images simultaneously, can you have them listening to the same port

A

Yes, as long as you bind them to a different port on your host machine

some-app://localhost:3000
some-app://localhost:3001

47
Q

How would you bind the container port (6379) to the local pc port (3000)

A

-p (host port):(container port)

docker run -p 3000:6379 postgres

48
Q

How can we stop all Containers that are running?

A

docker kill $(docker ps -q)

The docker ps command will list all running containers. The -q flag will only list the IDs for those containers

49
Q

How would you clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container)

A

docker prune

50
Q

how would you remove a specific docker image?

A

docker rm (Docker Image ID)

Remember, you can use docker ps -a to see all running AND non-running containers

51
Q

How do you get the logs for a specific container?

A

docker logs (Docker Container ID)

52
Q

For most Docker commands you can use the Docker Container ID, or?

A

the Docker name, listed in docker ps

53
Q

How can you chose your own name for a Docker Container?

A

docker run –name (my-name) (image)

54
Q

How would you access a terminal inside a running container?

A

docker exec -it (Docker Container ID) /bin/bash

55
Q

In Bash, how do you print the working directory?

A

pwd

56
Q

In Bash, how do you navigate to the home directory?

A

cd /

57
Q

In Bash, how do you list all files in a directory?

A

ls

lowercase LS

58
Q

In Bash, how would you print the environmental variables?

A

env

59
Q

If you’re in a terminal inside the container, how do you get back out to the original terminal?

A

exit

60
Q

When you go into a terminal inside a container based on linux, will you have all linux commands?

A

No

61
Q

How does docker run differ from docker start?

A

docker run starts a new container

docker start will only restart a stopped container

62
Q

If you only want to download an image, and not run it, how would you do that?

A

docker pull postgres

63
Q

Does a Docker Network access the internet?

A

No. It is an isolated virtual network

64
Q

Which of the following do you need to communicate with a container in the Docker Network?

localhost
port number

A

Containers in the Docker Network can talk to each other using just the container names

65
Q

How do you list all the Docker Networks?

A

docker network ls

66
Q

How do you create your own network in the Docker Network?

A

docker network create (chosen network name)

67
Q

How would you run a file named server.js with node from the cli

A

node server.js

68
Q

what is the protocol, uri usually

A

localhost:(port number)

69
Q

How would you display just the last log entry?

A

docker logs –tail 1 (image ID)

70
Q

docker logs -f (Image ID)

A

how run in detach?

71
Q

What is Docker Compose

A

A structured way to contain common docker commands

72
Q

Do you have to create a new network manually when using Docker Compose?

A

Nope

73
Q

How do you start containers with Docker Compose and yaml?

A

docker compose -f mongo.yaml up -d

74
Q

docker-compose -f mongo.yaml up

what does -f mean?

A

excelipty refercnng a file a file

75
Q

docker-compose -f mongo.yaml up

what does up mean?

A

up will start all the containers in the yaml

76
Q

When you restart a container, what happens to the data?

A

When you restart a container, everything you configured in that container is gone. There is no data persistence

77
Q

How would you use docker compose to stop all containers?

A

docker-compose - (filename.yaml) down

78
Q

Jenkins

A

Builds Docker Files (Images)

79
Q

What is a Docker File?

A

a Blueprint for building images

80
Q

Can you execute any Linux commands using RUN in a Dockerfile?

A

Yes

81
Q

If you create a directory with a dockerfile, does that directory get created on your host pc?

A

No

82
Q

COPY in dockerfile

A

Executes on the HOST machine

83
Q

What does the CMD do

can you only have CMD per dockerfile? yes only 1

A

entrypoint command

it runs start the app inside the container

CMD[“node”, “server.js”]

84
Q

What is alpine?

A

the lightest weight base

85
Q

Can you name a dockerfile anything you want?

A

No, it must be naemed “Dockerfile” (with no extension)

86
Q

How do you build an image with a Dockerfile?

A

docker build -t my-app:1.0 .

. = current directory, -t = ?

87
Q

When you change a Dockerfile what do you have to do for the changes to take effect?

A

Rebuild the image

88
Q

Docker rm vs docker rmi

A

docker rm removes the container

docker rmi removes the image

89
Q

What are 2 types of interactive terminals we can access inside the container?

A

/bin/bash

/bin/sh

90
Q

Docker push be written like

A

tag the image on azure

91
Q

Docker tag be written like

A

tag the image based on on azure

docker tag my-app:1.0 (Azure URI and name of image):1.0

92
Q

What must you do before you can push an image?

A

tag it

93
Q

When you tag an image does it make a copy or alter the original?

A

makes a copy

94
Q

If you have pushed an image, and later you change it, what are the steps to update it in the repository?

A

docker build -t my-app:(new version number) (path to docker file, usually “.”)

docker tag my-app:()new version number) (old version URI):(new version number)

docker push (old version URI):(new version number)

95
Q

deployment

A

lurn bout it

96
Q

docker inspect

A

give you info

97
Q

Typically, are private image names or public image names longer?

A

private, as they often include URIs

98
Q

What is a Docker Volume?

A

A folder on the local host files system is mounted into the virtual file system

99
Q

Basically how do Docker Volumes work?

A

When changes are made to the DB inside the container, they are copied over to the host machine

100
Q

What are the 3 types of Docker Volumes?

A

sum

Anonymous Volumes

Named Volumes

101
Q

How would you create a Docker Volume where you want to let docker decide where the Host Volume will be saved from the CLI?

A

docker run -v (container volume path)

102
Q

What is the benefit of a Named Volume?

A

You can reference the volume by name, you don’t have to use the full path

103
Q

How would you create a Named Volume

A

docker run -v name:(path)

104
Q

How would you create a Named Volume?

A

docker run -v name:(container volume path)

105
Q

How would you check

A

docker system df

docker system prune -a

106
Q

Look up online the default places where containers save their data

A

double check with

docker exec -it (image) /bin/bash

and then ls

107
Q

When a container completes startup, it runs the following command to ready the custom container image:

docker ____ –name balanced-container company-image

A

create

108
Q

When the load balancer detects high usage, it signals the virtual machine to make the container available for use. The VM runs the following command:

docker ____ balanced-container

A

start

109
Q

The load balancer detects that a container has been underutilized for more than 15 minutes. It signals the VM to suspend the container to conserve CPU resources. The VM runs the command:

docker ____ balanced-container

A

pause

110
Q

Finding an increased load again, the load balancer signals the VM to awaken the container. The VM runs the command:

docker ____ balanced-container

A

unpause

111
Q

After an hour of underutilization, the load balancer signals the VM to gracefully end all processes in the container to conserve RAM resources. The VM runs the command:

docker ____ balanced-container

A

stop

112
Q

Gracefully end all processes in the containers

A

docker-compose stop

113
Q

Remove the containers and their anonymous volumes

A

docker-compose rm -v