Docker Interview Questions and Answer Part – 26

What Docker Client command can be used to convert a Dockerfile into an Image?

  • docker createimage
  • docker buildimage
  • docker build (Ans)
  • docker create

Which of the following statements accurately describe a Docker volume?

  • Persisted even after a container is deleted
  • All of these (Ans)
  • Can be shared and reused among containers
  • Special type of directory in a container
  • Are not affected by updates to images

Which option can we pass to the Docker daemon to make it assign the Docker bridge a specific IP range?

  • –bip (Ans)
  • –network
  • –ip-range
  • –cidr

Which Dockerfile Instruction is the preferred instruction for setting the main process to run inside a container?

  • CMD
  • RUN

Which command shows us detailed container info including the containers PID within the Docker Hosts process tree?

  • docker config
  • docker detail
  • docker inspect (Ans)
  • docker pid

When using the ENTRYPOINT Instruction in a Dockerfile, how are CMD Instructions treated?

  • CMD Instructions are treated as arguments to the ENTRYPOINT Instruction (Ans)
  • CMD Instructions override ENTRYPOINT Instructions
  • ENTRYPOINT Instructions are ignored
  • CMD Instructions are ignored

Which Dockerfile Instruction do we use to install packages to our new Image?

  • FROM
  • RUN (Ans)
  • apt-get install
  • CMD

What is the name of the primary virtual Ethernet NIC inside of each Docker container?

  • veth0
  • eth1
  • veth1
  • eth0 (Ans)

Which Docker command lets us attach to a running container?

  • docker ssh
  • docker login
  • docker telnet
  • docker attach (Ans)

Which of the following docker run commands will start a Container based on an Ubuntu 14.04 Base Image?

  • docker run Ubuntu:14.04 ….
  • docker run ubuntu -v 14.04 …..
  • docker run ubuntu:14.04 …. (Ans)
  • docker run ubuntu –version=14.04 ….

Which of the following commands will install the Docker engine on an Ubuntu server?

  • cf install
  • rkt install docker
  • yum install docker
  • apt-get install (Ans)

Virtual Machines are a form of what type of virtualization?

  • Container
  • Hypervisor (Ans)
  • VLAN
  • Mainframe

How do recipient containers learn about the networking config of source containers they are linked to?

  • By querying the Docker daemon
  • Via a sub-space secure channel to the source container
  • Environment variables + entries in the /etc/hosts file (Ans)
  • The /link file in the root filesystem of the container

Which of the following commands will show version information for the various installed Docker components?

  • docker version (Ans)
  • apt-get update
  • docker detail
  • rkt version

Which Docker command builds a new image from a Dockerfile in the current directory?

  • docker build
  • docker build-image .
  • docker image .
  • docker build . (Ans)

What does pressing Control+P+Q inside of a container do?

  • Issues a print-screen of the current contents of the terminal window
  • Detaches the Docker Hosts terminal from the container (Ans)
  • Kills the container
  • Generates a stack trace of the container

Which Docker command shows running Docker Containers?

  • docker ps (Ans)
  • docker list containers
  • docker show containers
  • rkt ps

Which of the following is a major advantage of Containers over Virtual Machines?

  • Containers are more lightweight than Virtual Machines. (Ans)
  • Containers are encrypted by default.
  • A single Container can host more apps than a Virtual Machine.
  • Containers are cross-platform.

Which of the following is an advantage of Linking Containers when compared to exposing ports?

  • Linking containers is more efficient on memory.
  • Linking containers allow more active network connections.
  • Linking containers allows for faster container startup times.
  • Linking containers is considered more secure. (Ans)

What is the correct syntax to mount the /project/data directory from the Docker host into a directory called /data in a container?

  • docker run -v /data:/project/data
  • docker run -volumes-from /project/data:/data
  • docker run -v /project/data:/data (Ans)
  • docker run -volumes-from /data:/project/data
Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)