Docker Associate Certification Flashcards

Flash Cards for the Docker Associate Certification (59 cards)

1
Q

What lists all available/configured Docker networks?

A

docker network ls

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

What performs a Docker service create?

A
  • no volume (–volume or -v)

- –mount [source=/path],target=[path]

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

What is the docker swarm unlock-key --rotate command for?

A

It performs a key rotation for security on a regular basis.

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

How do you export the image ‘httpd:latest’ to a tar file called ‘httpd-latest.tar’?

A

docker save -o httpd-latest.tar httpd:latest

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

What is the Docker command to run a ‘hello-world’ image from the default repository?

A

docker run hello-world

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

What is the command to allow you to log in with the specified username to a remote image repository?

A

docker login –username=[USERNAME]

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

What is the directive within a Dockerfile that creates a mount point inside instantiated containers that can be used to mount external volumes?

A

VOLUME

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

What is the command to list all running swarms in your configuration?

A

docker swarm ls

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

How do you update a previously draining and/or removed node from the swarm cluster?

A

docker node update –availability active [NODE ID]

from master

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

What command stops a ‘stuck’ or ‘frozen’ container called ‘myweb’?

A

docker kill myweb

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

What is the command that lists the services running in your swarm cluster?

A

docker service ls

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

What’s the command to scale the number of instances in your swarm cluster, once the service is already running/deployed?

A

docker service scale [SERVICE NAME]=[NUMBER]

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

What demotes a ‘master’ or ‘manager’ node to a ‘follower’ node?

A

docker node demote [NODE ID]

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

What command promotes a ‘follower’ node to ‘master’ or ‘manager’?

A

docker node promote [NODE ID]

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

How do you create a Docker image from a Dockerfile in the current directory, naming the image ‘myimage:v1’?

A

docker build -t myimage:v1

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

What is the command to create a new Docker network for containers to use called ‘mynet’?

A

docker network create –subnet [RANGE] mynet

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

What command stops a running container called ‘myweb’ 10 seconds after executing the request?

A

docker stop -t 10 myweb

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

How do you find the Docker management token?

A

docker swarm

- join-token manager (to add another manager, following prompts)

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

What is the command to remove a service from your swarm cluster?

A

docker service rm [SERVICE NAME]

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

What is the directive in a Dockerfile that indicates the default command to run in instantiated containers unless overridden at launch time?

A

ENTRYPOINT

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

How do you perform a Docker swarm manager setup?

A

docker swarm

> init –advertise-addr [ip address of manager]

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

How do you create a service called ‘my_example’ with 4 replicas from the indicated image?

A

docker service create –name my_example –replicas 4 [IMAGE SERVICE]

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

What do you use to gracefully remove a node from a swarm cluster?

A

docker swarm leave (on the node to remove)

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

What does the following command do?

docker swarm unlock

A

Prompts for unlock key

25
What is the command used to initialize 'swarm mode'?
docker swarm init
26
How do you take a look at the indicated node to determine its status in the cluster (formatted cleanly)?
docker node inspect --pretty [NODE ID] (on the manager)
27
What command provides a 'human readable' method of showing the JSON output from inspect commands?
docker node inspect --pretty [nodeID]
28
How do you force a Docker Swarm that has lost majority by forcing a new swarm?
docker swarm init --force-new-cluster --advertise-addr [IP ADDRESS] (from ONE of the remaining master nodes)
29
What is the command to list the processes running in your swarm cluster?
docker service ps [SERVICE NAME]
30
What returns the status of a Docker Swarm cluster (from the manager node)?
docker node ls
31
What is the command to join an existing swarm as a 'worker' node?
docker swarm join --token [token] [IP]:2377
32
What command lists all available Docker networks in your system or swarm cluster?
docker network ls
33
What is the command to initialize a single replica?
docker service create [image]
34
How do you copy an image called 'httpd' from the default image repository?
docker pull httpd:latest OR docker pull httpd
35
How do you instantiate a container called 'myweb', running non-interactively, from an image called 'httpd:latest'?
docker run -d --name myweb httpd:latest
36
What directive in a Dockerfile that would allow you to install packages to be included with the image during the build process?
RUN
37
How do you display a list of all running containers on the system?
docker ps
38
What command will remove the image called 'mistake:v1' from the local system even if there are containers based on it?
docker rmi --force mistake:v1
39
What are the options to create and/or update a service?
- --name [name of service] - --publish [#:#] (publish indicated ports and map to underlying host - NOTE: bypasses routing mesh) - --env [var=value] (environment variable published to each worker in the swarm) - --workdir [directory] (working directory inside the container/service) - --user [username] (runas the indicated user) - --network [network name] (can be used to bypass the mesh network for an overlay) - --replicas [#] - --publish-add [#] (add port to host/swarm random high port) - --publish [-p] published=[port],target=[port][/protocol TCP or UDP] - --secret [filename] (allows the service access to Docker secrets, use this for each secret)
40
What command displays the logs for the specified service in your swarm?
docker service logs [SERVICE NAME] | from the manager
41
What is the command for a new swarm that will be locked on initialisation
docker swarm init --autolock --advertise-addr [ip of manager]
42
What is the output of the following command? | `docker volume ls`
- Lists created volumes. | - Will propagate on service creation.
43
What is the Docker logging driver sample configuration (daemon.json)?
{ "log-driver": "syslog" "log-opts": { "labels": "production_log", "env": "os,customer" } }
44
What command determines nodes in a swarm?
docker node ls
45
How do you initialize a Docker Swarm in order to make it ready to add nodes and services?
docker swarm init --advertise-addr [IP ADDRESS]
46
How do you display all Docker containers (running or stopped), but list ONLY the Container IDs and not the associated names?
docker ps -a -q
47
How do you re-initialize the swarm so it does not attempt to reconnect to old nodes?
docker swarm init --force-new-cluster
48
How do you deploy a container application as a service?
docker service create [SERVICE IMAGE]
49
The directive in a Dockerfile that instantiated containers will listen on the indicated port at launch.
EXPOSE
50
What are the options available for the following command? | `docker network create`
- --driver=overlay - --subnet=[network/mask] - --gateway=[IP] - --ip-range=[subnet/mask] - only good to further divide network from subnet definition
51
How do you set up the docker container inspect [container]?
- grep for 'IPAddress' for IP of container - grep for 'Ports' for port mapping information - --format="{{.NetworkSettings.Networks.[network driver].IPAddress}}" > for container IP
52
What command lists all images installed locally on a system?
docker images
53
How do you remove a 'down' node from a swarm cluster?
docker node rm [NODE ID] | on the manager
54
What command will remove a Docker network called 'mynet' from the configuration?
docker network rm mynet
55
Information about global service.
- Runs on each active node in the swarm, at least one * --mode [global] . - The replica is a default when not indicated OR when replica number is provided.
56
What command stops a running container called 'myweb'?
docker stop myweb
57
What are the available options for the following command? | `docker prune`
- --all (-a) - remove unused images (not just dangling) - --force (-f) - force removal without prompting - --volumes - prune unused volumes as well (not default)
58
What is the shortcut command to remove all stopped containers?
docker rm `docker ps -a -q`
59
What performs a Docker service create?
- no volume (--volume or -v) | - --mount [source=/path],target=[path]