Docker for Testing interview questions — Medium
198 medium-level Docker for Testing questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
Docker for Testing appears throughout Automation Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.
20 example questions
1. "Probe that reports whether a containerized service is ready" — in Docker, this describes which of the following?
- A. Health check.correct
- B. Volume.
- C. Docker-compose up.
- D. Docker run.
Why: health check: Probe that reports whether a containerized service is ready.
2. "Command that creates and starts a container from an image" — in Docker, this describes which of the following?
- A. Docker-compose up.
- B. Image tag.
- C. Docker run.correct
- D. ENTRYPOINT.
Why: docker run: Command that creates and starts a container from an image.
3. "Instruction defining the container's main executable" — in Docker, this describes which of the following?
- A. ENTRYPOINT.correct
- B. Docker-compose up.
- C. Dockerfile.
- D. Image tag.
Why: ENTRYPOINT: Instruction defining the container's main executable.
4. "Label identifying an image version, e.g., node:20" — in Docker, this describes which of the following?
- A. Image tag.correct
- B. Volume.
- C. Docker-compose up.
- D. Docker run.
Why: image tag: Label identifying an image version, e.g., node:20.
5. "Lists running containers" — in Docker, this describes which of the following?
- A. Docker ps.correct
- B. Volume.
- C. Image tag.
- D. ENTRYPOINT.
Why: docker ps: Lists running containers.
6. Which of the following statements about Docker is TRUE?
- A. Containers include a full guest operating system kernel like virtual machines.
- B. Docker-compose defines multi-container test environments (app, database, mocks) in one YAML file.correct
- C. Containerized browsers cannot be used for Selenium testing.
- D. A Docker container and a Docker image are exactly the same thing.
Why: Compose brings up an entire dependent stack with one command.
7. Which statement correctly describes Docker?
- A. Docker images are writable and change every time a container runs.
- B. Docker-compose defines multi-container test environments (app, database, mocks) in one YAML file.correct
- C. Docker-compose can only start one container at a time.
- D. Testcontainers requires manually deleting containers after every test.
Why: Compose brings up an entire dependent stack with one command.
8. Identify the accurate statement about Docker:
- A. Testcontainers requires manually deleting containers after every test.
- B. Containers include a full guest operating system kernel like virtual machines.
- C. Docker-compose can only start one container at a time.
- D. Docker-compose defines multi-container test environments (app, database, mocks) in one YAML file.correct
Why: Compose brings up an entire dependent stack with one command.
9. "Persistent storage mounted into a container" — in Docker, this describes which of the following?
- A. Volume.correct
- B. Docker ps.
- C. ENTRYPOINT.
- D. Dockerfile.
Why: volume: Persistent storage mounted into a container.
10. "Text file with instructions to build an image" — in Docker, this describes which of the following?
- A. Volume.
- B. Docker-compose up.
- C. Dockerfile.correct
- D. Health check.
Why: Dockerfile: Text file with instructions to build an image.
11. In Docker, which of the following is described as: "Probe that reports whether a containerized service is ready"?
- A. Health check.correct
- B. Docker run.
- C. Volume.
- D. ENTRYPOINT.
Why: health check: Probe that reports whether a containerized service is ready.
12. In Docker, which of the following is described as: "Label identifying an image version, e.g., node:20"?
- A. Volume.
- B. Image tag.correct
- C. ENTRYPOINT.
- D. Dockerfile.
Why: image tag: Label identifying an image version, e.g., node:20.
13. In Docker, which of the following is described as: "Instruction defining the container's main executable"?
- A. ENTRYPOINT.correct
- B. Docker run.
- C. Image tag.
- D. Health check.
Why: ENTRYPOINT: Instruction defining the container's main executable.
14. Which Docker concept matches this description: "Label identifying an image version, e.g., node:20"?
- A. ENTRYPOINT.
- B. Health check.
- C. Image tag.correct
- D. Docker run.
Why: image tag: Label identifying an image version, e.g., node:20.
15. Which Docker concept matches this description: "Command that creates and starts a container from an image"?
- A. Docker run.correct
- B. Volume.
- C. ENTRYPOINT.
- D. Image tag.
Why: docker run: Command that creates and starts a container from an image.
16. Which Docker concept matches this description: "Probe that reports whether a containerized service is ready"?
- A. Image tag.
- B. Docker-compose up.
- C. Health check.correct
- D. ENTRYPOINT.
Why: health check: Probe that reports whether a containerized service is ready.
17. In Docker, which of the following is described as: "Command that creates and starts a container from an image"?
- A. Docker-compose up.
- B. Health check.
- C. ENTRYPOINT.
- D. Docker run.correct
Why: docker run: Command that creates and starts a container from an image.
18. Which Docker concept matches this description: "Instruction defining the container's main executable"?
- A. Docker-compose up.
- B. ENTRYPOINT.correct
- C. Image tag.
- D. Health check.
Why: ENTRYPOINT: Instruction defining the container's main executable.
19. Which Docker concept matches this description: "Starts all services defined in the compose file"?
- A. Docker-compose up.correct
- B. Docker ps.
- C. Docker run.
- D. Image tag.
Why: docker-compose up: Starts all services defined in the compose file.
20. In Docker, which of the following is described as: "Persistent storage mounted into a container"?
- A. Dockerfile.
- B. Volume.correct
- C. Image tag.
- D. Docker run.
Why: volume: Persistent storage mounted into a container.