Which statement best explains why Dockerfiles automate the creation of Docker images?
Think about how Docker knows what to include inside an image.
Dockerfiles list commands like installing software and copying files. Docker reads these commands to build the image step-by-step automatically.
What is the expected output when running docker build -t myapp . in a directory containing a valid Dockerfile?
docker build -t myapp .Consider what happens when Docker builds an image step-by-step.
Docker shows each step from the Dockerfile as it builds the image, ending with a success message and the new image's ID.
Arrange the following steps in the correct order for Docker image creation using a Dockerfile.
Think about how Docker processes instructions step-by-step to build an image.
Docker first reads the Dockerfile, then executes instructions to create layers, combines them into an image, and finally saves it with a tag.
You run docker build but get the error: COPY failed: file not found. What is the most likely cause?
Check where Docker looks for files during build.
Docker only copies files from the build context (the folder where you run the build). If the file is missing there, COPY fails.
What is the main reason to keep the number of layers in a Dockerfile low when automating image creation?
Think about how layers affect image size and build efficiency.
Each Dockerfile instruction creates a layer. Minimizing layers reduces image size and speeds up builds and downloads.