These Docker multiple-choice questions and their answers will help you strengthen your grip on the subject of Docker. You can prepare for an upcoming exam or job interview with these 80+ Docker MCQs.
So scroll down and start answering.
The “rmi” command in docker is used to?
A. Save docker images to a tar archive
B. Remove one or more docker images
C. More image in remote to a different location
D. None
Choose the correct statement
A. The command 'docker images' creates images
B. The command 'docker load' loads a container
C. The command 'docker save' saves a container
D. The command 'docker rmi' removes an image
Which statement correctly describes a docker image.
A. A docker image is a self contained runtime environment
B. A docker image allows you to write the applications resources to the file-system in layers.
C. An image is a read only layer used to build a container. They do not change
D. A docker image is just an operating system
Choose the correct statement to describe the Docker repository
A. You can tag an image, and store multiple versions of that image with different GUIDs in a single named repository
B. A repository is a collection of containers tracked by GUIDs.
C. A repositoriy must e tied to a username.
D. A repository namespace has a specific schema so that the search index can determine the container id and location
Signed manifests include an image manifest and a list of signatures generated by libtrust. A signature consists of the following fields?
A. signature
B. header
C. protected
D. None of the above
In what format are Docker images identified?
A. 64 hexadecimal digit string
B. 128 binary digit string
C. 32 decimal digit string
D. None
The command to list all currently available images is?
A. docker list
B. docker images
C. docker ps
D. None
Which of the following is NOT true?
A. Compose is a tool for defining and running multi-container Docker applications.
B. Services that make up your app is defined in docker-compose.yml file
C. JSON format can be used for dockerfiles.
D. Docker ps is used to list all running containers
Which of the following is NOT a valid docker command for images?
A. build
B. commit
C. rmi
D. pause
Which statement best describes the possible security implications of public docker images
A. If you accidentally publish a credential(s), Delete the public image and update the credentials on whatever system(s) it has compromised
B. Data in a Docker volume is preserved as part of the docker commit operation so dont store credentials in volumes such as external api access keys
C. If a Docker image is deleted from the Docker Index then any sensitive data exposed will be safe
D. If a Docker image is deleted from the Docker Hub then any sensitive data exposed will be safe
What is the command used to convert a container into an image?
A. docker diff
B. docker run
C. docker commit
D. docker push
What format of compose files are supported by docker?
A. YAML
B. JSON
C. Both YAML and JSON
D. None
What does the docker management command dockerd do?
A. Launch the Docker daemon
B. Stop the docker daemon
C. Show the Docker version information
D. Display system-wide information
How do links and scaling work together in docker compose?
A. When scaling a container from a compose application you need to use the new multi-host networking functionality to connect containers across different physical or virtual hosts
B. When scaling a container from a compose application you need to use 'links' to connect containers across different physical or virtual hosts
C. You can only scale an unlinked container
D. Using 'links' ensures connections will be created to the newly scaled instances
Can an individual Docker container, for example a web server, that exposes (listens on) a port be started using systemd's socket activation feature?
A. It is not possible using default docker implementation
B. It is possible using a third party tool
C. It is possible using default docker implementation and a correct systemd unit file
D. It is possible using default docker implementation and a correct systemd socket descriptor
The docker compose sub-command “up” is used to?
A. A)Start containers
B. B)Create containers
C. C)Both A and B
D. D)Delete containers
Which command is used to show all running containers?
A. docker ps
B. docker list
C. docker list --all
D. docker ps --all
For the following 'docker-compose.yml' fragement scala: build: ./scala expose: - 40000-50000 ports: - 9000:9000 - 4040:4040 links: - mongo volumes: - ../../:/root/cardio - ~/.ivy2:/root/.ivy2 - ~/.sbt:/root/.sbt stdin_open: true Choose the most correct statement to describe the ' volumes' command as it appears in the code.
A. The ' volumes' command is used here to enable access from your container to a directory on the host machine.
B. The ' volumes' command is only useful for images that are going to be built FROM a given image
C. The ' volumes' command is used here to isolate the directories as they are explicitly named
D. The ' volumes' command is used here to link with other imported docker-compose.yml files
Scheduling strategies are how Swarm decides which nodes on a cluster to start containers on. Swarm supports the following strategies?
A. binpack
B. random
C. spread
D. None of the above
The command for running a docker container is
A. docker run
B. docker start
C. docker ps
D. None
Docker is
A. a software containerization platform
B. an automatic deployment tool
C. a continuous integration platform
D. All of the above
Which statement best describes Docker as a technology innovation.
A. Docker allows containers to be easier and safer to deploy and use.
B. Docker is driving standardization for containers.
C. Docker allows developers to pack, ship, and run any application to a lightweight, portable, self sufficient consistent production environment.
D. Docker containers that don't need an operating system kernel of their own, allow applications to run on a server.
Containers on the network ___ DNS mappings for the service via gossip so any container on the network can access the service via its service name?
A. transfer
B. configure
C. setup
D. share
Docker Universal Control Plane (UCP) is the enterprise-grade cluster management solution from?
A. Images
B. Docker
C. Swarm
D. LDAP
The “exec” command in docker is used to
A. Export a container’s filesystem
B. Run a command in a running container
C. Execute a stopped container
D. None
The container configuration filters are?
A. affinity
B. dependency
C. port
D. infinite
Custom, cross-host container networks are?
A. Inbound 7946/tcp
B. Inbound 7946/udp
C. Inbound
D. 489/udp
Docker can be integrated into various infrastructure tools, including?
A. Amazon Web Services
B. Google Cloud Platform
C. IBM Bluemix
D. Microsoft Azure
E.
Apache Flash Builder
Which of the following is true?
A. Processes running within a container can see, and but not affect, processes running in another container, or in the host system.
B. Processes running within a container cannot see, and even less affect, processes running in another container, or in the host system.
C. Processes running within a container can see, and even affect, processes running in another container, or in the host system.
D. Processes running within a container cannot see, and but affect, processes running in another container, or in the host system
Which statement best describes how Docker's Containers are different to Virtual Machines?
A. A Virtual Machine gives you the ability to snapshot the OS into a shared image. With a Docker Container runs in a shared OS.
B. A Virtual Machine can be cloned , Docker containers can not be cloned.
C. A Docker containers runs in the same kernel as it's host. A Virtual Machine gets it's own kernel.
D. Docker containers can be more portable than a Virtual Machine.
When using 'systemd' your docker containers start but get shut down instantly. Choose the best explanation for why this may be happening.
A. You are not using 'systemctl' to start the container
B. You have not specified a Type in your systemd unit file
C. 'systemd' is trying to start up groups of processes calling a service without correct permissions
D. The DefaultDependencies= is set to true but service units can not find needed dependencies
How will a server running multiple Docker containers handle the TCP limitation?
A. The total cap of TCP connections will be capped by the Docker host
B. The Docker host will use 'netfilter' in the Linux kernel to register callback functions with the network stack.
C. The Docker host will use 'netlink' in the Linux kernel to register callback functions with the network stack
D. By providing a full-duplex communication link.
What are the two major Docker components?
A. Container and image
B. Docker and docker-hub
C. Container and docker-hub
D. Docker and Container
The Docker client and daemon can communicate via?
A. Sockets
B. RESTful API
C. Both1 and 2
D. None
Docker diff command has 3 events listed in it. They are
A. N-New; U-Update; R-Remove;
B. A-Add; D-Delete; C-Change;
C. U-Update; D-Delete; C-Create;
D. None
The default registry is accessible using the command:
A. docker run search
B. docker ls
C. sudo docker search
D. None
In docker, a union file system is the union of ?
A. All read-write layers
B. Read-write layer and all read-only layers
C. All read-only layers
Docker is an open platform for developers and __ to build, ship, and run distributed application?
A. sysadmins
B. admin
C. sysadmin
D. All of the above
Choose the correct statement for Docker Swarm
A. Docker Swarm provides a common interface onto the many orchestration and scheduling frameworks.
B. Generic provisioning solution for Docker deployment.
C. A new LXC container environment.
D. Docker Swarm will act as Docker server to run Docker Containers.
Which statement correctly describes a ‘docker.sock’.
A. By default, a unix domain socket (or IPC socket) is created at /lib/var/docker.sock
B. The docker command line tool contacts the docker daemon process via a UNIX domain socket socket at /var/run/docker.sock
C. docker.sock runs on 32-bit linux kernels only
D. DOCKER_SOCK is the environment variable that must be set.
Can data volume containers be used/mounted in containers residing on other hosts within a docker swarm?
A. Docker, by itself, does not provide any facility for either migrating data or sharing data between hosts in a cluster
B. Yes Docker provides for migrating data or sharing data between hosts in a cluster with links and the new networking functionality
C. Docker provides for migrating data via volumes in a Docker swarm
D. This is possible when you use a cluster file-system
The default Engine and Swarm ports for TLS are?
A. Swarm manager: 3376/tcp
B. Authentication using TLS
C. Engine daemon: 2376/tcp
D. Network access control
A. Network
B. CPU
C. Server
D. None of the above
Choose the best description of the difference between a Docker container and a Linux process.
A. A container is basically a process, there is no practical diference
B. The diference between a container over a process is some extra kernel resources to manage namespaces, file systems and control groups
C. process supervision is only provided in a Docker container
D. A container only uses Linux processes for initialization, for everything else it uses threads
Docker containers can be
A. run, started, stopped, and deleted
B. started, stopped, moved, and deleted
C. started, stopped, and deleted
D. run, started, stopped, moved, and deleted
For the 'docker-compose.yml' fragment below
scala:
build: ./scala
expose:
- 40000-50000
ports:
- 9000:9000
- 4040:4040
links:
- mongo
volumes:
- ../../:/root/cardio
- ~/.ivy2:/root/.ivy2
- ~/.sbt:/root/.sbt
stdin_open: true
mongo:
image: mongo
volumes_from:
- data
ports:
- "27017:27017"
Choose the most correct statement to describe the 'links' block
A. Allows the container to be linked with ALL instances of the mongo service , but each with different alias
B. Allows the container to be linked with ALL instances of the mongo service
C. You need to explicitly declare this to link with the mongo service when running in the same host
D. This is required so you do not need to stop, remove, and run the container when running in a different host to generate the link
Swarm agents are responsible for hosting containers. They are regular docker daemons and you can communicate with them using the ___?
A. Docker Support
B. Docker Swarm API
C. Docker remote API
D. None of the above
Which of the following is True? In Docker, when a container is exited
A. The state of the filesystem and the processes are not preserved
B. The state of the filesystem is not stored but the state of the processes are stored
C. The state of the filesystem is stored but the processes are not
D. The state of the filesystem and the processes are preserved
What does the docker swarm command “swarm join” do?
A. Join two swarms
B. Join a swarm as a manager node or worker node
C. Join a node to another node to create a new swarm
D. None
Which of the following statement True of Docker Machine?
A. a tool for provisioning and managing your Dockerized hosts
B. a client-server application made up of docker daemon, api interfaces for interacting with daemon and a CLI client that talks to the daemon
C. A clustering tool for docker
D. A tool for automatic deployment of docker containers