kerDoc Flashcards

(113 cards)

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
What command can you run to see your local Docker configuration?
docker info
26
What 2 layers do OS's have?
OS Kernel Applications
27
What does an OS Kernel control?
Hardware
28
Is there a different Kernel for every distribution of Linux?
No. Only 1
29
What part of an OS does a Virtual Machine virtualize?
Applications layer and OS Kernel
30
What part of an OS does a Docker virtualize?
Applications layer
31
Does a Virtual Machine use a host kernel?
No, it spins up its own
32
Typically, are Docker Images or Virtual Machines smaller
Docker Images | Docker Images = MBs Virtual Machine= GBs typically
33
Does a Virtual Machine start faster than a DI?
no way
34
Can a Virtual Machine or a DI run any OS on any OS host?
Virtual Machine
35
What can you use to run a Linux DI on Windows
Docker Toolbox
36
What version of Windows and after do you not need to use Docker Toolbox?
Windows 10
37
Docker Quickstart Terminal?
it is
38
Does Docker use the local host's file system?
No, it creates its own virtual file system
39
What command can you use to see all Docker Images you have on your pc?
docker images
40
If you don't chose a specific version of Docker Image to pull, what happens?
You will pull the latest version
41
What is one way to stop a running Docker Container?
Ctrl+c
42
What is detach mode and how can you run it?
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
43
If some part of your Docker container crashes and you need stop and restart the whole thing, how would you do that?
docker stop (Docker Image ID) docker start (Docker Image ID)
44
How can you get a list of all Docker containers running and not running?
docker ps -a
45
Create binding between a port that your host machine has and the container
yep
46
If you are running 2 Images simultaneously, can you have them listening to the same port
Yes, as long as you bind them to a different port on your host machine some-app://localhost:3000 some-app://localhost:3001
47
How would you bind the container port (6379) to the local pc port (3000)
-p (host port):(container port) docker run -p 3000:6379 postgres
48
How can we stop all Containers that are running?
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
How would you clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container)
docker prune
50
how would you remove a specific docker image?
docker rm (Docker Image ID) Remember, you can use docker ps -a to see all running AND non-running containers
51
How do you get the logs for a specific container?
docker logs (Docker Container ID)
52
For most Docker commands you can use the Docker Container ID, or?
the Docker name, listed in docker ps
53
How can you chose your own name for a Docker Container?
docker run --name (my-name) (image)
54
How would you access a terminal inside a running container?
docker exec -it (Docker Container ID) /bin/bash
55
In Bash, how do you print the working directory?
pwd
56
In Bash, how do you navigate to the home directory?
cd /
57
In Bash, how do you list all files in a directory?
ls | lowercase LS
58
In Bash, how would you print the environmental variables?
env
59
If you're in a terminal inside the container, how do you get back out to the original terminal?
exit
60
When you go into a terminal inside a container based on linux, will you have all linux commands?
No
61
How does docker run differ from docker start?
docker run starts a new container docker start will only restart a stopped container
62
If you only want to download an image, and not run it, how would you do that?
docker pull postgres
63
Does a Docker Network access the internet?
No. It is an isolated virtual network
64
Which of the following do you need to communicate with a container in the Docker Network? localhost port number
Containers in the Docker Network can talk to each other using just the container names
65
How do you list all the Docker Networks?
docker network ls
66
How do you create your own network in the Docker Network?
docker network create (chosen network name)
67
How would you run a file named server.js with node from the cli
node server.js
68
what is the protocol, uri usually
localhost:(port number)
69
How would you display just the last log entry?
docker logs --tail 1 (image ID)
70
docker logs -f (Image ID)
how run in detach?
71
What is Docker Compose
A structured way to contain common docker commands
72
Do you have to create a new network manually when using Docker Compose?
Nope
73
How do you start containers with Docker Compose and yaml?
docker compose -f mongo.yaml up -d
74
docker-compose -f mongo.yaml up what does -f mean?
excelipty refercnng a file a file
75
docker-compose -f mongo.yaml up what does up mean?
up will start all the containers in the yaml
76
When you restart a container, what happens to the data?
When you restart a container, everything you configured in that container is gone. There is no data persistence
77
How would you use docker compose to stop all containers?
docker-compose - (filename.yaml) down
78
Jenkins
Builds Docker Files (Images)
79
What is a Docker File?
a Blueprint for building images
80
Can you execute any Linux commands using RUN in a Dockerfile?
Yes
81
If you create a directory with a dockerfile, does that directory get created on your host pc?
No
82
COPY in dockerfile
Executes on the HOST machine
83
What does the CMD do can you only have CMD per dockerfile? yes only 1
entrypoint command it runs start the app inside the container CMD["node", "server.js"]
84
What is alpine?
the lightest weight base
85
Can you name a dockerfile anything you want?
No, it must be naemed "Dockerfile" (with no extension)
86
How do you build an image with a Dockerfile?
docker build -t my-app:1.0 . | . = current directory, -t = ?
87
When you change a Dockerfile what do you have to do for the changes to take effect?
Rebuild the image
88
Docker rm vs docker rmi
docker rm removes the container docker rmi removes the image
89
What are 2 types of interactive terminals we can access inside the container?
/bin/bash /bin/sh
90
Docker push be written like
tag the image on azure
91
Docker tag be written like
tag the image based on on azure docker tag my-app:1.0 (Azure URI and name of image):1.0
92
What must you do before you can push an image?
tag it
93
When you tag an image does it make a copy or alter the original?
makes a copy
94
If you have pushed an image, and later you change it, what are the steps to update it in the repository?
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
deployment
lurn bout it
96
docker inspect
give you info
97
Typically, are private image names or public image names longer?
private, as they often include URIs
98
What is a Docker Volume?
A folder on the local host files system is mounted into the virtual file system
99
Basically how do Docker Volumes work?
When changes are made to the DB inside the container, they are copied over to the host machine
100
What are the 3 types of Docker Volumes?
sum Anonymous Volumes Named Volumes
101
How would you create a Docker Volume where you want to let docker decide where the Host Volume will be saved from the CLI?
docker run -v (container volume path)
102
What is the benefit of a Named Volume?
You can reference the volume by name, you don't have to use the full path
103
How would you create a Named Volume
docker run -v name:(path)
104
How would you create a Named Volume?
docker run -v name:(container volume path)
105
How would you check
docker system df docker system prune -a
106
Look up online the default places where containers save their data
double check with docker exec -it (image) /bin/bash and then ls
107
When a container completes startup, it runs the following command to ready the custom container image: docker ____ --name balanced-container company-image
create
108
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
start
109
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
pause
110
Finding an increased load again, the load balancer signals the VM to awaken the container. The VM runs the command: docker ____ balanced-container
unpause
111
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
stop
112
Gracefully end all processes in the containers
docker-compose stop
113
Remove the containers and their anonymous volumes
docker-compose rm -v