‹ Docker Interview Questions tests

Docker Interview Questions practice questions

10 questions in 1 test. Open one to answer it on its own, or take a whole test.

  1. A Node.js service has this Dockerfile: FROM node:20 / WORKDIR /app / COPY . . / RUN npm ci / CMD ["node", "server.js"] Developers complain that changing a single line of… · Images & Build Cache
  2. An image is built from a Dockerfile that ends with these two instructions: ENTRYPOINT ["python", "app.py"] and CMD ["--port", "8000"] An engineer starts a container with docker… · Dockerfile Instructions
  3. A Go service is built with FROM golang:1.26, then COPY . . and RUN go build -o /bin/app. The resulting image is close to 1 GB because it contains the whole Go toolchain, although… · Images & Build Cache
  4. A Node.js API registers a SIGTERM handler that closes database connections and logs "shutting down". Its Dockerfile ends with the shell-form instruction ENTRYPOINT node… · Container Runtime
  5. An image ships seed files in /app/data, and the application writes its state there at runtime. You need three things: the data survives docker rm and re-creating the container… · Storage
  6. You start two containers on one Linux host with docker run -d --name db postgres:16 and docker run -d --name api myapi, with no --network flag. The API is configured to connect… · Networking
  7. A Dockerfile contains ADD vendor.tar.gz /opt/vendor/, where vendor.tar.gz sits in the build context. Following a "prefer COPY over ADD" guideline, a teammate changes it to COPY… · Dockerfile Instructions
  8. A repository root contains the Dockerfile, the source, a 1.5 GB node_modules directory, the .git directory, and a .env file with API keys. The Dockerfile uses COPY . ., and the… · Images & Build Cache
  9. A compose.yaml defines web and a PostgreSQL service db, with depends_on: [db] under web. On docker compose up, db starts first, but web often crashes at startup with "connection… · Docker Compose
  10. A Dockerfile starts with FROM python:3.12.4-slim. Builds run on fresh CI runners with no local image cache. Two builds of the same commit, three weeks apart, produced images with… · Images & Registries