Docker Interview Questions and Answer Part – 17

If you run docker network ls and do not see a network that you’re looking for, what is the most likely culprit?culprit?

  • That node is not a worker node.
  • That node is not a manager node.
  • You’re not authorized to see the network.
  • That node doesn’t have a container running that uses that network. (Ans)

What does –update-parallelism control?

  • The time between updating tasks
  • The number of tasks updated at the same time (Ans)
  • What to do when an update fails
  • Whether or not to update all tasks at once, or one at a time

Which published port mode would you use to load balance requests across all containers for a service?

  • Host
  • None
  • Ingress
  • Bridge (Ans)
  • LoadBalanced

If you only have a replicated service, what will happen when you add a new node to the cluster?

  • The pending task for the service will be assigned to the new node and a container will be started.
  • The existing containers for the service will be rebalanced so that a fair share are placed onto the new node.
  • Nothing will run on the new node unless you change the service. (Ans)
  • A new task will be allocated to the new node for the global service.

If you want multiple containers for an application, what command is easiest to use to go from a service with one task replicas to two?

  • docker clone …
  • docker service rm; docker service create –replicas 2 …
  • docker service scale …
  • docker service update –replicas 2 … (Ans)
  • docker run …

On a swarm, if a container dies that’s part of a service, and a new container is created, what concept explains this?

  • High Availability
  • Desired State Reconciliation (Ans)
  • Scheduling
  • Service Scaling

What does the “*” mean in the output of docker node ls?

  • The nearest manager
  • The leader
  • A worker node
  • The node you’re connected to (Ans)

Joining a node as a manager by default that node will perform __ role(s).

  • Manager only
  • Leader only
  • Manager and Worker (Ans)
  • Replica only
  • Slave and Replica

Which of the following would you use to decrease the time between health checks?

  • retries
  • CMD
  • timeout
  • interval (Ans)

Assuming you have a stack called APIS, what is the equivalent of docker service ls for stacks?

  • docker stack deploy
  • docker stack services APIS (Ans)
  • docker stack ps APIS
  • docker stack ls

What happens to containers on a node that you drain?

  • They’re shut down until you make the node active again.
  • They keep running, just no new work is allowed to be put onto the node.
  • They’re snapshotted and migrated to other nodes.
  • They’re terminated and migrated as new containers on other nodes. (Ans)

Assuming you have a service named web, what will the dns query tasks.web return?

  • The Swarm Load Balancer
  • Individual container IPs for the web service (Ans)
  • The web service’s Virtual IP

What does –update-delay control?

  • What to do when an update fails
  • The number of tasks updated at the same time
  • The time between updating tasks (Ans)
  • Whether or not to update all tasks at once, or one at a time

What command do you use to create containers on a swarm?

  • docker service create (Ans)
  • docker swarm run
  • docker run
  • docker-compose up

Which of the following has a one-to-one relationship with a container?

  • Task (Ans)
  • Service
  • Image
  • Swarm

What can you put in front of a swarm so that end users don’t have to pick a node, nor deal with node failures, to access a service with a published port?

  • Round Robin DNS to all nodes
  • Load Balancer to all nodes (Ans)
  • Single DNS entry to one node

When no nodes in the cluster fulfill the constraints of a service, what is the status of the service?

  • Failed
  • Running
  • Pending (Ans)
  • Started

What does “starting” mean in terms of health checks?

  • The health check has not yet run for a new container. (Ans)
  • This shows each time the health check runs to indicate that it is starting.
  • The health checking service is starting up and is not ready to run health checks.

What happens when Docker Swarm Mode detects an unhealthy container?

  • Restarts the container
  • Shuts the corresponding task down and starts a new one (Ans)
  • Nothing, health checks are not integrated into Swarm Mode.
  • Sends an email to the system operator

Which of the following would you use to avoid recreating a task on a recoverable application failure?

  • retries (Ans)
  • timeout
  • interval
  • CMD
Rajesh Kumar