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. "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.
2. "Starts all services defined in the compose file" — in Docker, this describes which of the following?
- A. Image tag.
- B. Docker-compose up.correct
- C. Dockerfile.
- D. ENTRYPOINT.
Why: docker-compose up: Starts all services defined in the compose file.
3. "Command that creates and starts a container from an image" — in Docker, this describes which of the following?
- A. Docker ps.
- B. Image tag.
- C. Health check.
- D. Docker run.correct
Why: docker run: Command that creates and starts a container from an image.
4. "Instruction defining the container's main executable" — in Docker, this describes which of the following?
- A. Docker run.
- B. ENTRYPOINT.correct
- C. Dockerfile.
- D. Image tag.
Why: ENTRYPOINT: Instruction defining the container's main executable.
5. "Probe that reports whether a containerized service is ready" — in Docker, this describes which of the following?
- A. Dockerfile.
- B. Health check.correct
- C. Docker-compose up.
- D. Image tag.
Why: health check: Probe that reports whether a containerized service is ready.
6. Which statement correctly describes Docker?
- A. Containers package an application with its dependencies for consistent behavior across environments.correct
- B. Containers include a full guest operating system kernel like virtual machines.
- C. Docker-compose can only start one container at a time.
- D. Testcontainers requires manually deleting containers after every test.
Why: 'Works on my machine' issues shrink when tests run in containers.
7. "Lists running containers" — in Docker, this describes which of the following?
- A. Docker run.
- B. Health check.
- C. Docker ps.correct
- D. Volume.
Why: docker ps: Lists running containers.
8. Identify the accurate statement about Docker:
- A. Containerized browsers cannot be used for Selenium testing.
- B. Testcontainers requires manually deleting containers after every test.
- C. Docker-compose defines multi-container test environments (app, database, mocks) in one YAML file.correct
- D. Docker images are writable and change every time a container runs.
Why: Compose brings up an entire dependent stack with one command.
9. "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.
10. Which of the following statements about Docker is TRUE?
- A. Containerized browsers cannot be used for Selenium testing.
- B. Containers package an application with its dependencies for consistent behavior across environments.correct
- C. Docker images are writable and change every time a container runs.
- D. Testcontainers requires manually deleting containers after every test.
Why: 'Works on my machine' issues shrink when tests run in containers.
11. "Persistent storage mounted into a container" — in Docker, this describes which of the following?
- A. Docker-compose up.
- B. Health check.
- C. Volume.correct
- D. ENTRYPOINT.
Why: volume: Persistent storage mounted into a container.
12. Which Docker concept matches this description: "Starts all services defined in the compose file"?
- A. ENTRYPOINT.
- B. Docker-compose up.correct
- C. Dockerfile.
- D. Image tag.
Why: docker-compose up: Starts all services defined in the compose file.
13. In Docker, which of the following is described as: "Instruction defining the container's main executable"?
- A. ENTRYPOINT.correct
- B. Volume.
- C. Health check.
- D. Docker run.
Why: ENTRYPOINT: Instruction defining the container's main executable.
14. In Docker, which of the following is described as: "Starts all services defined in the compose file"?
- A. Docker run.
- B. ENTRYPOINT.
- C. Docker-compose up.correct
- D. Volume.
Why: docker-compose up: Starts all services defined in the compose file.
15. Which Docker concept matches this description: "Instruction defining the container's main executable"?
- A. Health check.
- B. Docker run.
- C. ENTRYPOINT.correct
- D. Image tag.
Why: ENTRYPOINT: Instruction defining the container's main executable.
16. Which Docker concept matches this description: "Label identifying an image version, e.g., node:20"?
- A. ENTRYPOINT.
- B. Docker run.
- C. Image tag.correct
- D. Dockerfile.
Why: image tag: Label identifying an image version, e.g., node:20.
17. 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.
18. Which Docker concept matches this description: "Command that creates and starts a container from an image"?
- A. Docker ps.
- B. Docker-compose up.
- C. Docker run.correct
- D. Image tag.
Why: docker run: Command that creates and starts a container from an image.
19. 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.
20. In Docker, which of the following is described as: "Command that creates and starts a container from an image"?
- A. Docker run.correct
- B. Dockerfile.
- C. Volume.
- D. ENTRYPOINT.
Why: docker run: Command that creates and starts a container from an image.