Docker Test 1 — Questions and Answers
Question 1: To connect a container to a network, select the docker command.
- docker connect
- docker link
- docker network connect (Correct answer)
- docker network link
Correct answer: docker network connect
Explanation: <br> You can connect external content to the network using the network name with the command $ docker network connect network name> container name>. To see the containers having network access, simply run the command.
Question 2: Which Dockerfile command should you use to make modifications to your Image and, as a result, the Containers that are launched from it?
- RUN (Correct answer)
- WORKDIR
- EXPOSE
- VOLUME
Correct answer: RUN
Explanation: <br> RUN — Specify commands to modify your Image and, as a result, the Containers created from it. This includes things like updating packages, installing software, adding users, setting up a database, and so on. These are the commands you'd use to install and configure your program from the command line.
Question 3: In Docker, what is a standardized, enclosed environment for running applications?
- Docker service
- Docker image
- Docker container (Correct answer)
Correct answer: Docker container
Explanation: <br> A Docker Container is a contained, standardized environment for running applications. The Docker API or CLI are used to manage containers. A Docker image is a container-building template that is read-only.
Question 4: Docker uses which file system to supply the building blocks for containers?
- NTFS
- VFAT
- HDFS
- None of the above (Correct answer)
Correct answer: None of the above
Explanation: <br> Union file systems are used by Docker to supply the building blocks for containers. AUFS, btrfs, vfs, and DeviceMapper are all union file system types that Docker can use.
Question 5: In Docker, which of the following has native clustering functionality?
- Docker Containers
- Docker Engines
- Docker Swarm (Correct answer)
- Docker Compose
Correct answer: Docker Swarm
Explanation: <br> A Docker Swarm is a collection of physical or virtual machines that have been configured to join together in a cluster and run the Docker application. You can still run the Docker commands you're used to once a set of machines has been clustered together, but they'll be handled by the machines in your cluster.
Question 6: What enables multiple Docker daemons to scale containers?
- Docker image
- Docker registry (Correct answer)
- Docker container
- Docker service
Correct answer: Docker registry
Explanation: <br> A Docker registry is a storage and distribution system for Docker images with particular names. Several copies of the same image may exist, each with its own set of tags. A Docker registry is divided into Docker repositories, each of which keeps track of all image changes.
Question 7: What is the Docker daemon's name?
- dockerproc
- dockerdaemon
- dockerprocess
- dockerd (Correct answer)
Correct answer: dockerd
Explanation: <br> The Docker daemon (dockerd) manages Docker objects such as images, containers, networks, and volumes by listening for Docker API requests. To manage Docker services, a daemon can communicate with other daemons.
Question 8: Which Dockerfile command modifies the environment variables within the image-based Containers?
- ENTRYPOINT
- ADD
- ENV (Correct answer)
- CMD
Correct answer: ENV
Explanation: <br> ENV is a container that will run in the future. For creating your Docker image, use ARG. The fundamental purpose of ENV is to offer default values for future environment variables. Environment variables can be accessed by running dockerized programs. It's an excellent approach to give your project configuration values.
Question 9: Which Dockerfile command specifies which files from the Host file system should be copied to the Container?
- ENV
- ENTRYPOINT
- ADD (Correct answer)
- CMD
Correct answer: ADD
Explanation: <br> Dockerfiles Command ADD - Defines files to copy from the Host file system onto the Container
To connect a container to a network, select the docker command.