Week 4 - Docker II Flashcards

(18 cards)

1
Q

How to run docker-compose in detached mode or in the background?

A. Use –daemon flag with docker-compose up command.

B. Use -d option with docker-compose up command.

C. Use docker-compose run –background command.

A

B. Use -d option with docker-compose up command.

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

Which commands can be used instead of docker-compose up?

A. docker-compose build and docker-compose start.

B. docker-compose build and docker-compose run.

C. docker-compose start and docker-compose run.
(docker-compose start will start pre-built containers only.)

A

B. docker-compose build and docker-compose run.

(docker-compose start will start pre-built containers only.)

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

Select all the options which applies to the Docker Swarm.
(This is a multi answer question. You can select one or more options as the answer.)

A. A container orchestration tool.

B. A tool from Docker to work with distributed deployments of containers.

C. A cluster of Docker hosts.

A

A, B, C

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

What is the right command to scale down a service running with 6 containers to 3
containers?

A. docker service <service_id> scale down 3.</service_id>

B. docker service scale <service_id>=3.</service_id>

C. docker services scale <service_id>=3.</service_id>

D. docker service <service_id> scale=3.</service_id>

A

B. docker service scale <service_id>=3.</service_id>

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

Q5: Select all the options which can be used to provide environment variables to a container
in docker-compose.yml file.
(This is a multi answer question. You can select one or more options as the answer.)

A. - env_file.
B. - environment.
C. - env.
D. ENV.

A

A. - env_file.
B. - environment.

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

Q6: How to specify the location of the Dockerfile in case of multiple Dockerfiles or to use a
Dockerfile located in a different location??

A. Use context and dockerfile keywords under build section.

B. Use dockerfile option and provide absolute path to the dockerfile.

C. Use directory option under build section with dockerfile.

A

A. Use context and dockerfile keywords under build section.

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

What are microservices?

A

Microservices are an architectural approach to developing software applications as a collection of small, independent services
- they communicate with each other over a network
- They are designed to perform a specific business function each
- They can be developed, deployed and scaled individually.

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

What is docker compose?

A

Docker Compose is a tool for running multi-container applications on Docker defined using docker-compose.yml file. A Compose file is used to define how the one or more containers that make
up your application are configured. Compose files can be used to deploy
applications locally, or to the cloud

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

What is the fundamental role of the Raft consensus algorithm in a Docker Swarm cluster?

A

It is used exclusively by the manager nodes to manage the clusters state. Primary goal is to ensure that all the manager nodes maintain and indentical, consistent internal state of the swarm. Shared state is stored in a replicated log and includes

  • Node membership (who has left and joined
  • The services running on the swarm
  • The desired state of applications
  • Any configs or secrets

This ensures fault tolerence, as if a manager fails another one is ready to step into its place with an exact copy of the internal state at the time.

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

How does Docker Swarm handle the failure of a leader manager node? Describe the Process.

A

Using raft consensus algorithm new leader is elected.

  1. leader manager periodically sends out heartbeat signals to other managers (followers) to assert authority
  2. If follower managers don’t receive these heartbeats for a certain period of time they assume leader has failed
  3. One or more followers will transition to the candidate state and start a new elecetion. They request votes from other available managers.
  4. The first candidate to receive votes from a majority of available managers (a quorum) is elected as the new leader.
  5. Once elected the new leader takes over orchestration and cluster management

makes swarm highly available.

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

Why does docker swarm recommend an odd number of managers nodes? How does this related to fault tolerence?

A

Recommends 3,5,7 to ensure Hight availability and prevent split brain scenarios during nework partitions, to ensure quorum. Quorum is min number of managers that must be available and agree on any change to the cluster state. (N/2 + 1) which can tolerate the loss of (N-1) / 2 managers. Prevents two groups from making conflicting decisions when network splits.

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

What are the benefits of dockercompose?

A
  • Single host deployment - run everything on one piece of hardware
  • Quick and easy config (YAML script)
  • High productivity (reduces time taken to complete tasks.
  • Security (all isolated from eachother reducing threats)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the key features of docker swarm?

A
  • Cluster management integrated with docker engine
  • Decentralized design
  • Scaling
  • Load Balancing
  • Secure by default
  • Rolling updates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which commands can be used instead of docker-compose up to start the containers?

A

docker compose build
docker compose start

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

What is the cmd that can be used to scale a service running 6 containers to 3?

A

docker service scale = 3

17
Q

Compare similarities and dissimilarities between the container and
virtual machine technologies.

A

Container: Small on disk space (MBs). Fast starting in seconds. Can be replicated more easily. More efficient. Can run 1000+ on a physical server. Software level virtualization.

VM: Large on disk space (GBs). Slower starting in minutes. Cannot be replicated easily. Less efficient. Can run 10+ on a physical server. Hardware and software level virtualization.

18
Q

Which of the following tools can help you install Docker Engine on multiple virtual hosts?

a. Dockerfile
b. Docker-compose
c. Docker machine
d. Docker-swarm and Kubernetes

A

c) docker machine