Docker Interview Questions and Answer Part – 9

Where does the file system come from for a container?

  • From a remote network share hosted through Hyper-V
  • From the machine the container is started on
  • From the image used to create the container (Ans)
  • From another special container called a parent container

What image type is blessed by both Docker and the people behind the software it contains?

  • Trusted
  • Blessed
  • Official (Ans)
  • Automated Build

How can you get files out of a container onto the host? Assume a process in a container is writing files, like ffmpeg saving the contents of a converted video. Where do you write this data?

  • Write files to the default host file system mounts at C:\host or /mnt/host on Linux
  • Write files to a volume mounted from the host (Ans)
  • Write files to network shares
  • Write files to the container file system, all writes are automatically copied to the host file system in the same folder

How can you see the output of a process running in a detached container?

  • docker run -it
  • docker logs (Ans)
  • docker ls
  • docker exec -it
  • docker output

Why do containers exist?

  • To make it easier to use virtual machines
  • A replacement for monolithic operating systems
  • A replacement for virtual machines
  • To make it easier to use software (Ans)

Which of the following allows you to add files from the host to a running container?

  • docker cp (Ans)
  • docker share
  • docker commit
  • docker volumes
  • docker add

Which of the following is a good analogy for creating a container?

  • Running software
  • Installing software (Ans)
  • Extracting a zip file
  • Downloading software

What is a repository on Docker Hub?

  • A single image
  • A collection of images (Ans)
  • An image ta
  • A user account

On a computer, with either Linux or Windows installed, there’s a program that runs in a privileged mode that abstracts hardware and provides services to other processes. What is this program?

  • Application
  • User space
  • User
  • Kernel space
  • Kernel (Ans)

What does docker-compose help us avoid? Excessive calls to __?

  • docker pull
  • docker stop
  • docker build
  • docker rm
  • docker run (Ans)

How can I run another process inside a running container?

  • docker start
  • docker ps
  • docker exec (Ans)
  • docker run

What does an image contain?

  • The user space files (Ans)
  • The operating system
  • Only an application’s files
  • Both the user and kernel space files
  • The kernel space files

On Windows 10 which container types can you run?

  • Hyper-V Containers (Ans)
  • Both Hyper-V and Windows Server Containers
  • Windows 10 Containers
  • Windows Server Containers

What is a dangling image?

  • An intermediate part of the chain of image layers
  • An image that’s not associated with a volume
  • An image that’s not associated with a tag (Ans)
  • An image that’s not associated with a running container

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

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

How can processes in different containers talk to each other when using docker-compose?

  • Pass IP addresses in configuration files
  • Embedded DNS for Service Discovery (Ans)
  • Linking containers
  • Pass IP addresses in environment variables

What’s a good analogy for docker exec?

  • It’s similar to installing software
  • Allows you to run additional processes in a container (Ans)
  • Allows you to run additional processes outside a container
  • Allows you to run additional processes in new containers

To get Ctrl+C to work to kill a container, what should you pass when running the container?

  • -it (Ans)
  • –name
  • -d
  • -p

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
  • gra (Ans)
  • grave_tesla
  • 57cf9c689955

What’s the primary purpose of docker-compose?

  • Pull and push images
  • Build containers
  • Build containers, volumes, and networks (Ans)
  • Build images
  • Cleanup containers.
Rajesh Kumar
Follow me