Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Docker Interview Questions and Answer Part – 16

Which of the following will upload a new stack to your Docker Cloud account?

  • docker-cloud stack create docker-cloud.yml
  • docker-cloud stack create -f docker-cloud.yml (Ans)
  • docker-cloud stack create -f dockerfile
  • docker stack create -f docker-cloud.yml

Docker Engine is:

  • The locally installed runtime through which you administrate Docker containers (Ans)
  • An online Docker administration interface
  • An online Docker image repository
  • A local Docker image repository

Docker Trusted Registry is:

  • A local, commercial image management tool
  • An open source tool for securing the infrastructure on which Docker Engine runs
  • A web-based, commercial, hosted image management tool (Ans)
  • An open source tool for coordinating Docker container clusters

A Docker container will run faster when its image is properly optimized. Which of the following will have the greatest positive impact on speed?

  • Build the image using as few layers as possible. (Ans)
  • Always base your images on the latest operating system version available.
  • Always be consistent in the software package versions you choose for your image layers.
  • Build the image using a Dockerfile rather than from a running container.

Where are the image files stored on a Linux machine running a package-based Docker Registry?

  • /var/lib/docker/docker-registry
  • /var/lib/docker/volumes//_data/docker/registry/v2/repositories/
  • /var/lib/docker/docker-registry/docker/registry/v2/repositories (Ans)
  • /var/lib/docker/docker-registry/docker/registry/v2/_catalog

Which of these commands will return a list of images currently stored in a Docker Registry?

  • docker images
  • curl 192.168.1.17:5000/v2/_catalog (Ans)
  • curl 192.168.1.17:5000/v2/_data
  • docker registry ls

Which of the following commands will successfully build an image with the name “myimage”?

  • docker build -t myimage
  • docker build –tag-image myimage
  • docker build -n myimage .
  • docker build -t myimage . (Ans)

What does “retries” specify for a health check?

  • How many times a container is restarted before it’s marked unhealthy
  • How many times an individual health check is simultaneously performed before assuming a failure
  • How many times a container is restarted before its task is shutdown and a new one is created
  • How many times a health check fails before a container is marked unhealthy (Ans)

docker-compose is roughly equivalent to what swarm mode command: __?

  • docker stack deploy (Ans)
  • docker service create
  • docker run

What purpose does the ingress network serve?

  • Routing traffic from published ports to running containers (Ans)
  • Load balancing internal container to container traffic
  • Routing internal container to container traffic

How are secrets made available to a container?

  • Environment Variables
  • Filesystem (Ans)
  • Socket
  • HTTP API

Pinning is the process of ______?

  • Resolving an image tag to a digest (Ans)
  • Assigning a image repository to a digest
  • Assigning a task to a node
  • Assigning a container to a task
  • Resolving a image digest to a tag

Which published port mode would you use to map the port on a given node to a specific container running on that node?

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

Services are a template for:

  • Containers
  • Tasks (Ans)
  • Images
  • Swarms

If you only have a global 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.
  • A new task will be allocated to the new node for the global service. (Ans)
  • 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.

Let’s say you have a service with four replicas, and four tasks currently running with IDs: A, B, C, and D. Let’s say you stop the container associated with task D.
What happens?

  • The service is terminated.
  • A new task E and a new container are created. Task D and its container are removed. (Ans)
  • The container is restarted.
  • The container is removed, and a new one is created and associated with Task D.

What happens if you try to view cluster state from a worker only node?

  • List of cluster state for all nodes
  • List of state for that worker node only
  • An error (Ans)

How can you see a log of health checks?

  • docker service ps MYSERVICE
  • docker ps
  • docker inspect CID (Ans)
  • docker service inspect MYSERVICE
  • docker stack ps MYSTACK

If you want to convert a worker node into a manager node, what do you use?

  • docker node demote
  • docker swarm worker
  • docker swarm manager
  • docker node promote (Ans)
  • docker node rm

A stack manages multiple:

  • Replicas
  • Nodes
  • Containers
  • Tasks
  • Services (Ans)
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)