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.”

Comments

Popular posts from this blog

Linux interview Questions :

Linux interview questions