Docker Interview Questions:
===========================
Docker interview questions:
================================
18. How do you troubleshoot a failing container?
* Check logs: docker logs
* Inspect container: docker inspect
* Exec into container: docker exec -it
==================================================
17. What is Docker Registry?
A storage for Docker images (e.g., Docker Hub).
==============================================
. How will you deploy a microservice using Docker + Kubernetes?
✅ Answer (structured & practical)
First, I containerize the application using Docker.
Step 1: Create Docker Image
* Write a Dockerfile
* Build image:
docker build -t myapp:v1 .
* Push to registry:
docker push myrepo/myapp:v1
Step 2: Create Kubernetes Deployment
Define a Deployment YAML:
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myrepo/myapp:v1
ports:
- containerPort: 80
Apply:
kubectl apply -f deployment.yaml
Step 3: Expose Service
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
type: LoadBalancer
selector:
app: myapp
ports:
- port: 80
targetPort: 80
Step 4: (Optional but important)
* Use Ingress for routing
* Add ConfigMaps & Secrets
* Add HPA (Auto Scaling)
🎯 Final Line (say this in interview)
“I containerize the application, push the image to a registry, create Kubernetes Deployment and Service manifests, and expose it using LoadBalancer or Ingress. I also ensure scalability and configuration management using HPA, ConfigMaps, and Secrets.”
🔹 2. How will you handle Zero Downtime Deployment?
✅ Answer (Production-level)
I use Rolling Updates in Kubernetes.
🔁 Rolling Update Strategy
* Gradually replaces old pods with new ones
* Ensures some pods are always available
Example:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
🧠 Key Techniques:
1. Readiness Probes
* Ensures traffic goes only to healthy pods
2. Liveness Probes
* Restarts unhealthy containers
3. Blue-Green Deployment
* Two environments (old + new)
* Switch traffic after validation
4. Canary Deployment
* Release to small % of users first
🎯 Final Line
“I use rolling updates with readiness probes to ensure zero downtime. For critical systems, I prefer blue-green or canary deployments to minimize risk.”
🔹 3. How will you debug production container issues?
✅ Answer (Step-by-step troubleshooting)
🔍 Step 1: Check Pod Status
kubectl get pods
kubectl describe pod
📄 Step 2: Check Logs
kubectl logs
kubectl logs -f
🖥 Step 3: Exec into Container
kubectl exec -it -- /bin/bash
Check:
* Processes
* Config files
* Network connectivity
🌐 Step 4: Check Service & Networking
kubectl get svc
kubectl describe svc
📊 Step 5: Resource Issues
kubectl top pods
* Check CPU / Memory usage
⚠️ Step 6: Events & Crash Analysis
kubectl get events
Look for:
* CrashLoopBackOff
* OOMKilled
🧠 Real-world tools:
* Monitoring: Prometheus, Grafana
* Logging: ELK stack
* Alerts: CloudWatch / GCP Monitoring
🎯 Final Line
“I follow a structured approach: check pod status, logs, exec into the container, verify networking and resources, and analyze events. I also use monitoring and logging tools for deeper insights.”
Linux interview Questions :
1).How to recover accidently deleted /etc/fstab into linux os ? anyone deleted this /etc/fstab .after this we can' boot ur os. boot into recovery mode . then go to the linux terminal page . here we have to execute the blkid command here it will list out the avilble partions and attached filesystems . if your deleting the /etc/fatab.that time root parttion won't be work now we can mount the root parttion in rw mode mount -t ext4 -0 rw,remount dev/sda1 / 2).VMSTAT command into linux ? 3).iostat and dstat command into linux os ? 4).LInux free command into linux os ? in this way we can check it our the memeory usage and swap memeory as well. then it will display out the , used,space avilble ,total ,buffer/catche abd shared what is free space we can execute the command like as the, free -b command : we will get the particular output for the bits so if you want to getto int the outpit in kilobytes : so we can execut ethe comamnd like as the, free -k free -g: it will sh...
Comments
Post a Comment