Which statement best describes Docker image layers?
Think about how Docker reuses parts of images to save space.
Docker images are made of stacked read-only layers. Each layer adds or modifies files. This stacking allows efficient storage and sharing.
What is the output of the command docker history alpine?
docker history alpineTry to recall what docker history shows about images.
docker history lists the layers of an image, showing size, creation time, and commands that created each layer.
You want to reduce the number of layers in your Docker image. Which Dockerfile snippet achieves this best?
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
Think about how Docker creates a new layer for each RUN instruction.
Combining commands with && in a single RUN instruction creates only one layer, reducing image size.
Your Docker image is unexpectedly large. Which cause is most likely related to image layers?
Think about how layers keep all changes, even deleted files if not cleaned properly.
Each RUN creates a layer. If temporary files are created and not removed in the same RUN, they remain in the layer, increasing image size.
Which Dockerfile practice best leverages layer caching to speed up rebuilds?
Think about how Docker caches layers and when cache is invalidated.
Docker caches layers in order. If a layer changes, all following layers are rebuilt. Ordering commands from least to most frequently changing maximizes cache reuse.