#devopsengineer
#devopsmadeeasy
#docker
#interviewquestions
Beginner Level
What is a Dockerfile and why do we use it?
What’s the difference between ADD and COPY in a Dockerfile?
What is the purpose of the ENTRYPOINT and CMD instructions? How are they different?
Explain the use of the WORKDIR instruction.
How do you expose a port from a Docker container using a Dockerfile?
What is the function of the FROM instruction? Can you have multiple FROM instructions in a single Dockerfile?
What does the RUN command do in a Dockerfile?
How can you reduce the number of layers in a Docker image?
Intermediate Level
What’s the difference between RUN, CMD, and ENTRYPOINT?
How do you pass environment variables into a Docker container from a Dockerfile?
What’s a multi-stage build in Docker? Why is it useful?
How do you make sure your Docker image is as small as possible?
If a Dockerfile uses COPY . ., what potential issues might arise in CI/CD pipelines?
How would you add versioning or build metadata into your Docker image?
What’s the difference between ARG and ENV? When would you use each?
Advanced Level
How do you handle secrets or sensitive configuration in Docker builds?
Suppose your container starts and immediately exits. How would you debug this using the Dockerfile?
What’s the implication of using latest in your FROM instruction?
Explain how Docker’s build cache works with respect to Dockerfile instructions.
How would you optimize a Dockerfile for faster builds in a CI/CD environment?
How can you ensure deterministic builds in Docker?
What security best practices would you follow when writing a Dockerfile?
How do you copy only specific files/folders from a Git repo using the Dockerfile?
How would you test a Dockerfile without pushing to a registry?
What’s the effect of using .dockerignore, and why is it important?