Docker & Containerization Flashcards
6 cards from real DevOps practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Docker & Containerization flashcards as text
What is the difference between ENTRYPOINT and CMD in a Dockerfile?
Answer: ENTRYPOINT defines the executable that always runs; CMD provides default arguments that can be overridden
ENTRYPOINT sets the fixed executable that cannot be overridden at runtime, while CMD provides default arguments that users can replace when running the container.
What Docker registry command uploads a local image to Docker Hub?
Answer: docker push
`docker push` transfers a locally tagged image to a remote registry such as Docker Hub or a private registry.
What is a Docker layer?
Answer: An intermediate read-only filesystem snapshot created by each Dockerfile instruction
Each Dockerfile instruction creates a new read-only layer stacked on top of previous layers; Docker caches layers to speed up subsequent builds.
Which flag in `docker run` maps a host port to a container port?
Answer: -p host_port:container_port
The `-p` (publish) flag maps a specific host port to a container port so external traffic can reach the containerized service.
What does the `docker exec` command do?
Answer: Runs a command inside an already running container
`docker exec` executes an additional command inside a running container without stopping it, commonly used to open a shell for debugging.
What is a 'distroless' Docker image?
Answer: An image containing only the application and its runtime dependencies, without a Linux distribution
Distroless images contain only the application binary and its required runtime libraries, omitting package managers, shells, and OS utilities to reduce attack surface.