Back to the catalog

Docker in practice: build cache, image layers, stop signals & container storage

36 questions

Each Question puts you in a concrete Docker situation. You decide what reaches the builder, when the build cache hits, what ends up in the image, how containers stop, how ports and networks connect, where data survives, and how isolated a container is.

Questions

  1. Not answered. Can COPY reach a sibling directory outside the build context?
  2. Not answered. What happens when .dockerignore excludes a file that COPY requests?
  3. Not answered. Which ignore file wins when a build has two?
  4. Not answered. Why does COPY main.c /src/ fail when you pipe in the Dockerfile?
  5. Not answered. Does touching a copied file invalidate its build cache?
  6. Not answered. Which changes can invalidate the cache for COPY package.json /app/?
  7. Not answered. Why can RUN apt-get update return week-old data during a rebuild?
  8. Not answered. Which Dockerfile order keeps dependencies cached when you edit source code?
  9. Not answered. What must be true of a build that uses RUN --mount=type=cache?
  10. Not answered. How should you pass a private registry token to one build step?
  11. Not answered. Does rotating a build secret invalidate the cache for the RUN step that uses it?
  12. Not answered. Which build-stage files end up in the final image?
  13. Not answered. Which image does docker build --target test . produce?
  14. Not answered. Why does deleting a 200 MB archive in a later RUN still leave the image about 200 MB bigger?
  15. Not answered. Where does a container's write to /etc/app.conf go when the file came from the image?
  16. Not answered. What happens the first time a container on OverlayFS changes one byte of a large image file?
  17. Not answered. Which image reference pulls the same image every time?
  18. Not answered. Why might ENTRYPOINT node server.js hide Docker's stop signal from Node?
  19. Not answered. What does docker stop do when the main process does not exit during its grace period?
  20. Not answered. By default, how many seconds does Docker wait before killing an unresponsive Linux container?
  21. Not answered. Why would you use docker run --init?
  22. Not answered. What does EXPOSE 8080 do by itself?
  23. Not answered. Where does traffic to host port 8080 go with docker run -p 8080:80 nginx?
  24. Not answered. Who can reach a port published with -p 8080:80 and no host IP?
  25. Not answered. How should web connect to db on the same user-defined bridge?
  26. Not answered. What does localhost mean inside the web container?
  27. Not answered. Do you need to publish a database port so another container on the same user-defined bridge can reach it?
  28. Not answered. What happens to a named volume after the container using it is removed?
  29. Not answered. What's in a new, empty volume when you mount it over an image directory that has files?
  30. Not answered. What does a default read-write bind mount over /app do?
  31. Not answered. What happens to files in a Docker tmpfs mount when the container stops?
  32. Not answered. What happens to database files in a container's writable layer when you delete the container?
  33. Not answered. Which statements about default Linux container isolation are true?
  34. Not answered. Without resource limits, how much CPU and memory can a container use?
  35. Not answered. With these limits, how many megabytes of swap can the container use?
  36. Not answered. What does Docker's default seccomp profile do on a supported Linux host?