Linux+ Container Operations with Docker Flashcards
7 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Linux+ Container Operations with Docker flashcards as text
A container is running but needs to be stopped gracefully. Which signal does docker stop send by default before force-killing the process?
Answer: SIGTERM
docker stop sends SIGTERM first, giving the process time to shut down cleanly, then sends SIGKILL after a timeout (default 10 seconds).
Which Dockerfile instruction is used to define the default working directory for subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions?
Answer: WORKDIR
WORKDIR sets the working directory inside the container image and creates it if it does not exist.
What does the --read-only flag do when passed to docker run?
Answer: Makes the container's root filesystem read-only, preventing writes
The --read-only flag mounts the container's root filesystem as read-only, improving security by preventing unauthorized file modifications.
A Linux administrator wants containers on two different Docker hosts to communicate. Which network driver should be used?
Answer: overlay
Overlay networks span multiple Docker hosts using VXLAN encapsulation and require a key-value store like etcd or Consul for coordination.
What happens to container data stored in a named volume when the container is deleted with docker rm?
Answer: The volume persists and must be removed separately with docker volume rm
Named volumes have an independent lifecycle from containers; deleting a container does not remove its associated named volumes.
Which command shows the layer history and build commands used to create a Docker image?
Answer: docker history
docker history displays each layer of an image, its size, and the instruction that created it.
When using docker run -p 8080:80, what does port 8080 represent?
Answer: The host machine's port that maps to the container
In -p host_port:container_port format, 8080 is the host port that forwards traffic to port 80 inside the container.