DevOps interviews for freshers cover Linux commands, Git workflows, Docker images and containers, Kubernetes basics, CI/CD pipelines, infrastructure as code with Terraform, and monitoring. Interviewers want clear mental models and one or two things you have run yourself. These 36 questions give short answers and proofread shell, Dockerfile, YAML and Terraform examples.
On this page
Linux and Git (Q1 to Q10)Docker and containers (Q11 to Q19)Kubernetes basics (Q20 to Q26)CI/CD, Terraform and monitoring (Q27 to Q36)How to prepare in two weeksFrequently asked questionsFor students and freshers aiming at DevOps, cloud, SRE (site reliability engineering) and platform roles in India. The answers describe stable behaviour of the tools and were checked against the official Kubernetes, Docker, Terraform and GitHub Actions documentation, and the Google SRE book for monitoring. Docker, Terraform and Kubernetes were not installed on the machine used to write this, so their snippets were proofread and YAML was parsed, but not executed. The shell pipeline and the error-budget script were run.
Search Console export of 26 November 2026 has no direct row for these queries. Google Trends India (research/trends/trends-summary.json) shows searches for the DevOps roadmap peaking in July, so a seasonal January to March interview lift is not confirmed for DevOps specifically. The wider interview group peaks in February. Start with the DevOps engineer roadmap, and use Docker for beginners, CI/CD pipeline explained and the Git and GitHub commands cheat sheet for hands-on practice.
Linux and Git (Q1 to Q10)
Expect a Linux terminal question in almost every DevOps round. The pipeline below counts HTTP status codes in a web server access log (combined format, status in field 9). It was run on a three-line sample log.
#!/usr/bin/env bash
set -euo pipefail
# Show the five most frequent HTTP status codes in an access log
awk '{print $9}' access.log | sort | uniq -c | sort -rn | head -5
Output on the sample log:
2 200
1 404- Q1. How do you find which process is using a port?
ss -tulpn | grep :8080(orlsof -i :8080). Thenps -p <pid>to see the command. Say what you would do next: check whether the process is expected before killing it. - Q2. How do you check disk, memory and CPU?
df -hfor disk,du -sh *to find large folders,free -hfor memory, andtoporhtopfor CPU and processes. Mentionuptimefor load average. - Q3. Explain file permissions
rwxr-xr--. Owner can read, write and execute. Group can read and execute. Others can only read. In numbers that is 754.chmod 754 filesets it andchown user:group filechanges the owner. - Q4. What does
set -euo pipefaildo in a shell script?-eexits on a failing command,-uerrors on unset variables and-o pipefailmakes a pipeline fail if any stage fails. It stops scripts from carrying on after a hidden error. - Q5. How do you read the last errors in a large log?
tail -n 200 app.log | grep -i error, orjournalctl -u myservice --since '1 hour ago'for systemd services. Usetail -fto follow live. - Q6. What is the difference between a process and a service, and how do you manage a service? A process is a running program. A service is a long-running process managed by an init system. With systemd use
systemctl status|start|stop|restart <name>andsystemctl enable <name>to start at boot. - Q7. Merge or rebase? Merge keeps history and adds a merge commit. Rebase replays your commits on top of another branch for a linear history. Rebase only your own unpublished work, and never rewrite shared branches.
- Q8. How do you undo a commit?
git revert <commit>adds a new commit that cancels it and is safe on shared branches.git resetmoves the branch pointer and rewrites history, so use it only on local work.git restorediscards file changes. - Q9. How do you resolve a merge conflict? Open the files with conflict markers, choose or combine the right lines, remove the markers,
git addthe files and continue the merge or rebase. Run the tests after. - Q10. Describe a branching strategy. Trunk-based development uses short-lived branches merged to main often, supported by feature flags. Gitflow uses long-lived develop and release branches. Trunk-based suits fast CI/CD, and Gitflow suits scheduled releases.
git switch -c fix/login-bug # new branch
git add -p && git commit -m "Fix login redirect"
git fetch origin && git rebase origin/main # replay your commits on the latest main
git push --force-with-lease # safe force push after a rebase of YOUR branch
git revert <commit> # new commit that undoes one, safe on shared branchesDocker and containers (Q11 to Q19)
A short Dockerfile you should be able to explain line by line. Layer order matters: copying package*.json and installing first lets Docker reuse the cached layer when only source code changes.
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
USER node
EXPOSE 8080
CMD ["node", "server.js"]| Question | Virtual machine | Container |
|---|---|---|
| What is virtualised? | Hardware, with a full guest OS | The process environment, sharing the host kernel |
| Start time | Usually minutes | Usually seconds or less |
| Size | Gigabytes | Often tens to hundreds of megabytes |
| Isolation | Stronger (separate kernel) | Weaker (shared kernel, namespaces and cgroups) |
| Typical use | Different OS, strong isolation | Packaging and running app services |
- Q11. What is Docker, and why use it? Docker packages an app with its dependencies into an image that runs the same on a laptop, a CI runner and a server. It removes 'works on my machine' differences. See Docker for beginners.
- Q12. Image or container? An image is a read-only template built in layers. A container is a running instance of an image with a writable layer on top. You can start many containers from one image.
- Q13. What do
CMDandENTRYPOINTdo? Both define what runs when the container starts.ENTRYPOINTis the fixed executable, andCMDgives default arguments thatdocker runcan override. Prefer the exec (JSON array) form. - Q14. How do you reduce an image's size? Use a small base image, multi-stage builds so build tools stay out of the final image,
.dockerignore, fewer layers and no package caches. The Docker docs list these in their build best practices. - Q15. How do containers keep data? Container storage is lost when the container is removed. Use volumes (managed by Docker) or bind mounts to persist data, for example a database directory.
- Q16. How do containers talk to each other? On a user-defined bridge network they reach each other by container name. Docker Compose creates one for a project. Use
-p host:containerto publish a port to the host. - Q17. What is Docker Compose? A YAML file that defines several services, networks and volumes, started with
docker compose up. Good for local development with an app and a database. - Q18. Why not run as root in a container? A compromised process with root has more power if it escapes. Add a non-root
USER, as in the Dockerfile above, and drop unneeded capabilities. - Q19. A container keeps restarting. What do you check?
docker ps -afor the exit code,docker logs <id>, the command and environment variables, resource limits (an exit code 137 often means the process was killed, commonly for memory) and whether a dependency was up.
Kubernetes basics (Q20 to Q26)
Freshers are asked the vocabulary and one manifest. A Deployment keeps a set of identical pods running and replaces them gradually on update. The manifest below parsed as valid YAML, and was not applied to a cluster.
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: myrepo/web:1.4.2
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 256Mi
- Q20. What is Kubernetes? An open-source system that runs containers across a cluster of machines: it schedules them, restarts failed ones, scales them and routes traffic. It does not build images.
- Q21. What are a Pod, Deployment and Service? A Pod is one or more containers sharing a network and storage. A Deployment manages replica pods and rolling updates. A Service gives a stable address and load balancing to a changing set of pods chosen by labels.
- Q22. How does a rolling update work? The Deployment starts new pods in small steps while removing old ones, keeping the app available. If new pods fail their readiness check, the rollout stops.
kubectl rollout undo deployment/webreverts it. - Q23. Liveness and readiness probes? Readiness decides whether a pod receives traffic. Liveness decides whether the container should be restarted. A slow-starting app with a wrong liveness probe can be restarted in a loop.
- Q24. A pod is in CrashLoopBackOff. What do you do?
kubectl describe pod <name>for events,kubectl logs <name> --previousfor the last crash, then check the image, command, environment variables, config, probes and memory limits. - Q25. ConfigMap or Secret? Both inject configuration. ConfigMaps hold non-sensitive settings. Secrets are for sensitive values, but by default are only base64-encoded, not encrypted, so enable encryption at rest and restrict access.
- Q26. Requests and limits? A request is what the scheduler reserves for a pod. A limit is the cap. Exceeding a memory limit gets the container killed. Exceeding a CPU limit throttles it.
CI/CD, Terraform and monitoring (Q27 to Q36)
A pipeline definition in GitHub Actions syntax. It runs tests on every pull request, and builds an image only on main after the tests pass. Parsed as valid YAML; not run against GitHub.
name: ci
on:
pull_request:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm test
build:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t myrepo/web:${{ github.sha }} .
- Q27. What is the difference between continuous integration, delivery and deployment? CI merges and tests small changes often. Continuous delivery keeps every build releasable with a manual approval. Continuous deployment releases every passing change automatically. See CI/CD pipeline explained.
- Q28. What does a typical pipeline contain? Checkout, install, lint, unit tests, build, security scan, package an artifact or image, deploy to staging, smoke test, then production with approval or automation.
- Q29. How do you keep secrets out of a pipeline? Use the CI platform's secret store or a vault, inject them at run time, never commit them, rotate on leak and prefer short-lived credentials. Check history if one was committed.
- Q30. Blue-green or canary deployment? Blue-green runs two full environments and switches traffic at once, with fast rollback and double cost. Canary sends a small share of traffic to the new version first, and widens if metrics stay healthy.
- Q31. What is infrastructure as code? Describing servers, networks and services in versioned files so environments are reviewable, repeatable and easy to rebuild. Terraform is a common declarative tool.
- Q32. Explain
terraform init,planandapply, and what state is.initdownloads providers,planshows the diff between code and recorded state,applyperforms it. State maps your code to real resources. Store it remotely with locking, because losing it or editing it by hand causes drift. - Q33. Terraform or Ansible? Terraform provisions infrastructure declaratively (create a network or VM). Ansible configures what runs on machines, and is often used for setup and orchestration. They are commonly combined.
- Q34. What do monitoring, logging and tracing each answer? Metrics show that something is wrong and how much. Logs show what happened in detail. Traces show where time went across services. Alert on symptoms users feel, such as error rate and latency.
- Q35. What are SLI, SLO and error budget? An SLI is a measured indicator (percent of good requests). An SLO is the target for it. The error budget is the allowed failure, and when it is spent, releases slow down in favour of reliability.
- Q36. An outage just happened. What is your process? Acknowledge, assess impact, mitigate first (roll back, scale, fail over), communicate status, then find root cause and write a blameless post-incident review with action items.
resource "aws_s3_bucket" "logs" {
bucket = "my-app-logs-example-123"
tags = {
env = "dev"
}
}terraform init # download providers
terraform plan # show what would change, touch nothing
terraform apply # make the change after you confirmThe error budget behind Q35 is plain arithmetic. This script ran on Python 3.9.6:
# Error budget: how much downtime does an availability target allow per 30 days?
minutes = 30 * 24 * 60
for slo in (99.0, 99.9, 99.99):
print(f"{slo}% -> {minutes * (1 - slo / 100):.1f} minutes of allowed downtime")
99.0% -> 432.0 minutes of allowed downtime
99.9% -> 43.2 minutes of allowed downtime
99.99% -> 4.3 minutes of allowed downtimeEach extra nine cuts allowed downtime by 10 times, so a 99.99% target leaves about four minutes a month. That is why a fresher who can say 'I would set the SLO before the alert' sounds experienced.
How to prepare in two weeks
- Install Docker and write a Dockerfile for a small app. Break it deliberately and read the logs.
- Start a local cluster (kind or minikube), deploy the manifest above and run a rolling update.
- Create a GitHub Actions workflow that tests, builds and fails on purpose, then fix it.
- Write a Terraform config for one cheap resource and run plan, apply and destroy in a sandbox account.
- Practise ten Linux commands on a cloud VM until you can explain each flag.
- Document one end-to-end project in a README with an architecture diagram. Ideas are in DevOps project ideas.
For salary context see the DevOps engineer salary in India page, and for the learning order the DevOps engineer roadmap. Cloud providers have free tiers, but check current limits and billing alerts before you create anything.
Frequently asked questions
What are the most common DevOps interview questions for freshers?
Linux commands and permissions, Git merge versus rebase, what Docker images and containers are, a basic Kubernetes Deployment and Service, what CI/CD means, what Terraform state is, and how you would respond to an outage. Interviewers often ask you to describe a pipeline you built.
How do I prepare for Docker interview questions?
Build and run a real image, then explain each Dockerfile line, layer caching, volumes, networking and running as a non-root user. Practise debugging a restarting container from logs and exit codes. Hands-on answers beat memorised definitions.
What are CI/CD interview questions about?
Mostly the difference between CI, continuous delivery and deployment, the stages of a pipeline, how secrets are handled, deployment strategies such as blue-green and canary, and how you would roll back. Be ready to sketch a pipeline file.
Do I need Kubernetes as a fresher?
You need the basics: pods, deployments, services, probes, config and how to read logs. Deep operations knowledge is not expected. Many entry roles list Docker and CI/CD as the core and treat Kubernetes as a plus.
Is coding required for DevOps interviews?
Scripting is expected: bash and often Python for automation. Some roles add basic DSA or a coding screen. Be able to parse a log, call an API or write a small tool. Check the job description.
What is the difference between DevOps and SRE?
DevOps is a set of practices that join development and operations, such as automation and CI/CD. SRE, from Google, applies software engineering to reliability, with SLOs and error budgets. Many job posts blend them, so read the responsibilities.
Learn this with mentors
Programmes for builders and engineers with admissions open: live classes, mentors and project work.


