Dockerfile MCQs with answers
67 questions tagged Dockerfile, each with the correct answer and an explanation. Page 3 of 4.
- What does `ENV APP_ENV=production` do?
- What does `EXPOSE 80` do in a Dockerfile?
- What is the purpose of the `COPY` instruction?
- What is the difference between `CMD` and `ENTRYPOINT`?
- How can you add metadata to an image using Dockerfile?
- Which instruction is used to specify the default command when a container starts?
- What does the `RUN` instruction do in a Dockerfile?
- Which instruction in Dockerfile is used to specify the base image?
- Where is the best place to put a `.dockerignore` file?
- Which of the following is not a valid Dockerfile instruction?
- Which instruction is used to switch the user in a Dockerfile?
- Where is the default context path when building a Dockerfile?
- Which command builds a Docker image from a Dockerfile?
- What is a multi-stage build in Dockerfile?
- What does the VOLUME instruction do?
- Which best practice helps reduce Docker image size?
- What is the effect of using multiple RUN commands in a Dockerfile?
- Which instruction allows the Dockerfile to accept variables at build time?
- What is the difference between CMD and ENTRYPOINT?
- Which instruction is used to include metadata labels in a Dockerfile?