Docker: What Actually Happens?
Test what Docker does with build contexts, caching, image layers, multi-stage builds, Unix signals, networking, storage, and Linux isolation. Each Question asks you to reason through a concrete situation.
Questions
- Not answered. Can
COPYreach a sibling directory outside the build context? - Not answered. What happens when
.dockerignoreexcludes a file thatCOPYrequests? - Not answered. Which ignore file controls a build when both applicable files exist?
- Not answered. Why does
COPY main.c /src/fail when the Dockerfile is piped as the build context? - Not answered. Does touching a copied file invalidate its build cache?
- Not answered. Which changes can invalidate the cache for
COPY package.json /app/? - Not answered. Why can
RUN apt-get updatereturn week-old data during a rebuild? - Not answered. Which Dockerfile order keeps the dependency cache when application source changes?
- Not answered. What must be true of a build that uses
RUN --mount=type=cache? - Not answered. How should you pass a private registry token to one build step?
- Not answered. Does rotating a build secret automatically invalidate the consuming
RUNcache? - Not answered. Which build-stage files end up in the final image?
- Not answered. Which image does
docker build --target test .produce? - Not answered. Why can deleting a 200 MB archive in a later
RUNleave the image roughly 200 MB larger? - Not answered. Where does a running container write
/etc/app.confwhen the file came from its image? - Not answered. What can happen when an OverlayFS-backed container changes one byte in a large image file for the first time?
- Not answered. Which image reference guarantees the same published image content on later pulls?
- Not answered. Why might
ENTRYPOINT node server.jshide Docker's stop signal from Node? - Not answered. What does
docker stopdo when the main process does not exit during its grace period? - Not answered. By default, how many seconds does Docker wait before killing an unresponsive Linux container?
- Not answered. Why would you use
docker run --init? - Not answered. What does
EXPOSE 8080do by itself? - Not answered. Where does traffic to host port 8080 go with
docker run -p 8080:80 nginx? - Not answered. Who can potentially reach
-p 8080:80when no host IP is specified? - Not answered. How should
webconnect todbon the same user-defined bridge? - Not answered. What does
localhostmean inside thewebcontainer? - Not answered. Must a database port be published for a peer on the same user-defined bridge to reach it?
- Not answered. What happens to a named volume after the container using it is removed?
- Not answered. What initially appears in a new empty volume mounted over a non-empty image directory?
- Not answered. What does a default read-write bind mount over
/appdo? - Not answered. What happens to files in a Docker
tmpfsmount when the container stops? - Not answered. What happens to database files written only into a container's writable layer after that container is deleted?
- Not answered. Which statements accurately describe default Linux container isolation?
- Not answered. Without resource limits, how much CPU and memory can a container use?
- Not answered. With these limits, how many megabytes of swap can the container use?
- Not answered. What does Docker's default seccomp profile do on a supported Linux host?