Docker Interview Questions and Answer Part – 30

Images contain the entire user space, in other words the entire file system for a container. How is this not horribly inefficient in terms of disk space?

  • Images are layered and common layers are shared (Ans)
  • Images use state of the art compression to reduce the disk space requirements
  • You only pull down the image layers that you need to run your application
  • Image layers are highly optimized to reduce unnecessary components.

Say you have the following output from docker ps:
57cf9c689955 docs/docker.github.io “/bin/sh -c ‘jekyll s” About an hour ago Exited (137) About an hour ago grave_tesla

Which of the following does not work as a container identifier (CID) when running a command like the following?
docker stop
docker start
docker rm

  • 57
  • 57cf9c689955
  • grave_tesla
  • gra (Ans)

How do you terminate software running in a container?

  • docker stop (Ans)
  • docker rm
  • docker terminate
  • docker kill

Which of the following Windows Features do you need to use Windows Server containers?

  • Docker
  • Containers (Ans)
  • Hyper-V and Containers
  • Hyper-V

Which of the following stops all running containers?

  • docker stop $(docker ps -q) (Ans)
  • docker rmi $(docker ps -q)
  • docker halt $(docker ps -q)
  • docker rm -f $(docker ps -q)

Where do dangling volumes typically come from?

  • Containers that we manually mount managed volumes into
  • Images that have a VOLUME instruction (Ans)
  • Containers that we bind-mount host volumes into
  • Every container that is created has a volume created as well

Where are created, modified, and deleted files stored in a container?

  • In a volume mounted in the container
  • In an R/W container layer (Ans)
  • In the bottom most layer from the image it was created from
  • In the top most layer from the image it was created from

In the past, to launch an installed application, we would run an executable file. How does Docker run software?

  • Pull a container
  • Install a container
  • Runs an executable (Ans)
  • Create a container

How are image layers coalesced to form a container’s file system?

  • Files are copied out of layers when creating a container into a union mount point
  • A union file system is used to create a union mount point (Ans)
  • Container file systems exist in memory, in a RAM disk, aggregated from image layers

How can you connect a container to a user defined network?

  • –udf NETWORK_NAME
  • docker connect
  • –net NETWORK_NAME (Ans)
  • docker attach
  • docker disconnect

In traditional software management, we uninstall software to remove it from a machine, what’s the equivalent with Docker?

  • Remove an image
  • Uninstall a container
  • Remove a container (Ans)
  • Stop an image
  • Stop a container

When you extract an image with docker save what is inside the tar archive?

  • The contents of all layers flattened into one folder
  • A folder for the entire image and also a layers folder with each layer nested inside
  • A folder for each image layer (Ans)

The docker history command shows output similar to which of the following?

  • Dockerfile (Ans)
  • docker ps
  • docker images
  • docker-compose.yml
  • docker layers

What is the role of Docker images?

  • All of these
  • Used to execute code at runtime
  • Provides virtualization functionality across environments
  • Acts as a blueprint or template that is used to create containers (Ans)

What command can be used to start a container?

  • docker run [image name](Ans)
  • docker go [image name]
  • docker rm [image name]
  • docker ps -a

Which of the following tasks can Docker Compose perform?

  • View service logs
  • None of these
  • Build services
  • All of these (Ans)
  • Start and stop containers

Services can be organized into __ with Docker Cloud.

  • groups
  • stacks (Ans)
  • roles
  • zones

What Docker Compose command can be used to start multiple service containers?

  • docker-compose up (Ans)
  • docker-compose start
  • None of these
  • docker run

A Docker _ has a “thin R/W layer.”

  • File
  • Image
  • None of these
  • Container (Ans)

Each instruction in a Dockerfile creates an intermediate container as the image is built.

  • True (Ans)
  • False

What syntax can be used to convert a Dockerfile into an Image?

  • docker create -t /tagName .
  • docker run -t /tagName .
  • docker run -t /tagName . (Ans)
  • docker convert -t /tagName .

Which of the following tools are included in Docker Toolbox?

  • All of these (Ans)
  • Docker Machine
  • Docker Client
  • VirtualBox
  • Docker Kitematic
Rajesh Kumar
Follow me