Docker & Kubernetes test (Intermediate)
30 questions · 35 minutes · Free
Images, containers, pods, deployments and services.
Take the Docker & Kubernetes test
What it covers
- Images and layers
- Dockerfile best practice
- Pods and deployments
- Services and ingress
- Config and secrets
Interview format
- Questions: 30 questions — 18 multiple choice, 12 multi-answer
- Time: 35 minutes, timed from the first question
- Difficulty: Intermediate
- Skill area: DevOps & cloud
- Price: Free
Earn a certificate
The Docker & Kubernetes test is one of the 8 tests of the Backend Developer learning path. Pass it and the other 7 tests at 70% or more and readyforhires issues you a verifiable certificate in your name, with its own code and verify link to share or add to LinkedIn.
Sample questions
5 sample questions from the Docker & Kubernetes test, with the answers. Samples are taken out of the live test, so you will not meet these when you sit it.
Which Dockerfile concept refers to the sequential processing of instructions to ensure a deterministic and efficient build process?
- Layer inheritance
- Image tagging conventions
- Dockerfile instruction order
- Dockerfile multi-stage builds
Answer: C. Dockerfile instruction order
The order of instructions in a Dockerfile is crucial because Docker builds images layer by layer. Instructions like `RUN`, `COPY`, and `ADD` are processed sequentially, and changes made in later instructions do not affect earlier layers. This ensures that the build process is deterministic and efficient.
Which of the following statements correctly describes how Dockerfile instructions are processed and how they affect image layers?
- Dockerfile instructions are processed in the order they are written, but only the first instruction creates a new layer.
- Dockerfile instructions are processed in reverse order, and only the final instruction creates a new layer.
- Dockerfile instructions are processed in the order they are written, but layers are merged into a single layer.
- Dockerfile instructions are processed in the order they are written, and each instruction creates a new layer in the image.
Answer: D. Dockerfile instructions are processed in the order they are written, and each instruction creates a new layer in the image.
Dockerfile instructions are executed sequentially, and each instruction adds a new layer to the image. This order is critical for building efficient images and ensuring that dependencies are properly layered.
What is the recommended method for storing binary data in a ConfigMap in Kubernetes?
- Plain text
- Binary compression
- Hexadecimal encoding
- Base64 encoding
Answer: D. Base64 encoding
When storing binary data in ConfigMaps, it is recommended to use Base64 encoding to ensure compatibility and avoid issues with special characters. This is a standard practice in Kubernetes to handle binary data within ConfigMaps.
Which of the following statements correctly describes the first instruction in a Dockerfile?
- A Dockerfile should start with a FROM instruction to specify the base image.
- A Dockerfile should start with a COPY instruction to copy files from the host into the image.
- A Dockerfile should start with a RUN instruction to execute commands during the build process.
- A Dockerfile should start with a CMD instruction to define the default command.
Answer: A. A Dockerfile should start with a FROM instruction to specify the base image.
The FROM instruction is the first and only required instruction in a Dockerfile, as it defines the base image upon which the Docker image is built. Other instructions like COPY, RUN, and CMD follow in a logical order to construct the image.
Which scenario represents a common mistake when configuring Pod container limits that can lead to out-of-memory errors?
- The container's CPU limit is set to 500m, but the application is requesting 1CPU.
- The container's memory limit is set to 1GB, but the application is requesting 512MB.
- The container's memory limit is set to 512MB, but the application is requesting 1GB of memory.
- The container's CPU limit is set to 1CPU, but the application is requesting 500m.
Answer: C. The container's memory limit is set to 512MB, but the application is requesting 1GB of memory.
When a container's memory limit is set lower than the application's memory request, it can cause out-of-memory (OOM) errors. Kubernetes will not allow the container to use more memory than the limit, which can lead to termination if the application exceeds the limit. The correct answer highlights this scenario, which is a common mistake when configuring resource limits.
Frequently asked questions
- How many questions are in the Docker & Kubernetes test?
- 30 questions (18 multiple choice, 12 multi-answer), with 35 minutes to answer them.
- What does the Docker & Kubernetes test cover?
- Images and layers, Dockerfile best practice, Pods and deployments, Services and ingress, Config and secrets.
- Is the Docker & Kubernetes test free?
- Yes. It is free to take with a readyforhires account.
- What level is the Docker & Kubernetes test?
- Intermediate, in DevOps & cloud.