These questions cover advanced concepts, real-world scenarios, troubleshooting, and optimization techniques you are likely to encounter in an SRE role.
If this useful, please star this repo :)
-
What is Docker, and how does it differ from Virtual Machines?
Explain containerization vs virtualization. -
Can you explain the Docker architecture? What are the key components?
Docker Engine, Docker CLI, Docker Daemon, Docker Images, Containers, and Registries. -
What happens when you run
docker run hello-world
? Explain step-by-step. -
What is the difference between
docker run
,docker start
, anddocker exec
? -
What is the difference between
COPY
andADD
in a Dockerfile? When would you use each? -
What are multi-stage builds in Docker? Why are they useful for production deployments?
-
How do you optimize Docker image size? Give practical steps.
E.g., using lightweight base images like Alpine, multistage builds, removing unnecessary files, minimizing layers, etc. -
How can you debug a container that exits immediately after starting?
-
What is the difference between
ENTRYPOINT
andCMD
in a Dockerfile? Can you override them? -
How do you inspect the environment variables and configuration of a running container?
-
What is the role of
docker-compose
? What is the difference betweendocker-compose up
anddocker-compose down
? -
What happens if you do not specify a
WORKDIR
in a Dockerfile? -
How do you handle logs for Docker containers? What tools would you use for log aggregation?
-
Explain how you would copy a file from a running container to the host machine.
-
How can you reduce container startup time for a large application?
-
What are Docker networks, and what are the different types of Docker networks?
Bridge, host, overlay, and macvlan networks. -
How would you connect two containers running on different hosts?
-
Explain the difference between port binding (
-p
) and exposing a port (EXPOSE
) in Docker. -
How does Docker handle DNS resolution for containers?
-
What happens if you use
--network=host
mode? What are the advantages and disadvantages?
-
What are Docker volumes? How do they differ from bind mounts?
-
How would you persist data from a container?
-
What is the difference between named volumes and anonymous volumes?
-
How can you back up and restore Docker volumes?
-
What are some security best practices you follow while working with Docker?
E.g., using non-root users, scanning images for vulnerabilities, minimizing image size, etc. -
How can you restrict resource usage for a container (e.g., CPU and memory limits)?
Use--cpus
,--memory
, or cgroups. -
How do you scan a Docker image for security vulnerabilities? What tools do you use?
-
What is Docker Content Trust, and how does it help improve image security?
-
Explain the concept of a Docker “rootless mode.” Why is it significant?
-
What is the purpose of
seccomp
,AppArmor
, orSELinux
in Docker security?
-
How do you troubleshoot a container that keeps restarting?
-
What steps do you take when you encounter the error
OCI runtime create failed
? -
How do you clean up unused Docker containers, volumes, and networks?
-
Explain how to handle zombie processes inside a container.
-
How can you check why a container is consuming too much memory or CPU?
-
How do you monitor Docker containers in production? What tools or methods do you use?
Prometheus, Grafana, cAdvisor, ELK stack, etc. -
Explain how you would recover from a corrupted Docker image or container.
-
How do you resolve a
Docker daemon not responding
issue?
-
How do you integrate Docker into CI/CD pipelines? Which tools do you use?
Jenkins, GitLab CI, GitHub Actions, etc. -
What is a Docker registry? What are the differences between Docker Hub, ECR, and private registries?
-
How do you push and pull Docker images from a private registry?
-
How do you ensure Docker containers restart automatically on failure?
-
What role does Docker play in Kubernetes?
-
How do you manage secrets in a Docker container securely?
-
Imagine a containerized app works locally but fails in production. How would you debug it?
-
How would you troubleshoot a network connectivity issue between two containers?
-
What would you do if Docker images take too long to build during deployment?
-
How would you migrate containers running on a Docker Engine to Kubernetes?
-
How do you ensure zero downtime when deploying updates to a containerized application?
-
You have a container running out of memory and crashing. What tools and steps would you use to analyze and resolve it?
-
If your Docker image builds are too large, what actions would you take to improve efficiency?
-
You notice a resource-intensive container affecting host performance. How would you limit its resource usage immediately?
-
A containerized application throws intermittent errors but works fine most of the time. What steps would you take to investigate this?
-
What would you do if you accidentally deleted a Docker volume containing important data?
-
A team member created a Dockerfile, but the container keeps crashing. How would you perform a code review to find the issue?
- What tools do you use for container monitoring and health checks?
- How do you automate container cleanup in production?
- Which tools do you prefer for Docker image vulnerability scanning?
To ace these questions as an SRE, make sure you can:
- Explain concepts clearly.
- Use real-world examples or scenarios you've handled.
- Understand how Docker integrates with tools like Kubernetes, CI/CD, and monitoring systems.
- Troubleshoot and optimize effectively.
#devops