Docker Basics Flashcards

1
Q

Command to get docker version

A

docker –version

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

What is docker hub

A
  • Docker hub is a public docker registry at hub.docker.com
  • anyone can access these images
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

route to find docker image registries in docker hub

A
  • http://hub.docker/r/{ imagename }
  • registries hold repositories.
  • repository:version
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to specify the port in a docker run

A
  • docker run -p { port1 }:{ port2 }
  • docker run -p { 5000 }:{ 5000 }
  • -p is short for publish.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is it called when an image is running?

A

a container

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

What is the bridge network

A

Internal docker network. All containers run inside the bridge network. You cannot access the container unless the container is exposed to the outside.

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

What is the first port and second port of a specified docker container. EX: 5000:5000

A

The first port number is a host port and the second is the container port

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

How to launch docker container detached from the command line

A

add a { -d } to the docker run command

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

command to print out logs

A

docker logs { container id/name }

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

how to follow the logs of a docker container

A

-f
exL docker logs -f { container id/name }

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

How to list out images created

A

docker images

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

how to list all the running containers

A

docker container ls

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

how to follow the logs of a docker container

A

-f
ex: docker logs -f { container id/name }

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

what option allows you to list out all the docker containers. Even the ones that have been exited

A

-a
docker container ls -a

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

What is the docker Client?

A

Docker client takes our commands and sends them to the docker daemon.
- It pulls images
- Manages your containers
- pushes images to the repository

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

What is the docker daemon

A

Docker daemon is the server side. Docker is a client server architecture

17
Q

How to download an image to local storage

A

pull
docker pull {image}

18
Q

How to see the layers of a docker image

A

history
docker image history { image }

19
Q

How to find specs/metadata about the docker image

A

inspect
docker image inspect { image }

20
Q

how to remove an image

A

remove or rm
docker image rm { image_name }

21
Q

How to pause a container

A

pause
docker container pause { image_name }

22
Q

How to restart a paused docker container

A

docker container unpause { image_name }

23
Q

What is the difference from docker container stop and kill?

A

Docker container stop gracefully closes the processes that are running.
docker container kill sends the command sig kill. This drops everything and terminates it right away. Is not graceful

24
Q

Get details about a container

A

inspect
docker container inspect { id/name }

25
Q

How to remove containers that are stopped

A

docker container prune

26
Q

How to get general docker information on the hardware

A

docker system { option }

27
Q

Get rid of all the Exited containers and images that are not used

A

docker system prune -a

28
Q

Command used to print the amount of resources being used by docker containers

A

docker stats
docker stats -f

29
Q

How to set the limit of memory a docker container can use

A

-m 512m

ex: socker container run -p 5000:5000 -d -m 512 {image}

30
Q

Specifiy what percentage of the cpu can be used by the docker container

A

–cpu-quota=50000
ex: socker container run -p 5000:5000 -d -m 512 –cpu-quota=500000 {image}