Complete Docker Interview Preparation Guide for .NET, Microservices & DevOps
Docker అనేది modern software development మరియు DevOps environmentsలో అత్యంత ముఖ్యమైన containerization technology.
ప్రత్యేకంగా .NET Core / ASP.NET Core, Microservices, Azure, Kubernetes మరియు CI/CD projectsలో Docker knowledge చాలా ముఖ్యమైనది.
ఈ articleలో:
- Docker Basics
- Docker Images
- Docker Containers
- Dockerfile
- Docker Commands
- Docker Networking
- Docker Volumes
- Docker Compose
- Docker Security
- Docker Registry
- Docker + .NET
- Docker + Azure
- Docker + Kubernetes
- Docker CI/CD
- Real-Time Scenario Questions
అన్నీ interview perspectiveలో చూద్దాం.
Part 1: Docker Basics
1. Docker అంటే ఏమిటి?
Answer:
Docker అనేది applicationsను containersలో package చేసి run చేయడానికి ఉపయోగించే containerization platform.
ఒక applicationకు అవసరమైన:
- Application code
- Runtime
- Libraries
- Dependencies
- Configuration
వంటి వాటిని ఒక container imageలో package చేసి, different environmentsలో consistentగా run చేయవచ్చు.
Example
ఒక ASP.NET Core application developer machineలో పనిచేస్తోంది.
కానీ:
Developer Machine
↓
Testing Server
↓
Production Server
ప్రతి environmentలో dependencies సమస్యలు రావచ్చు.
Docker ఉపయోగిస్తే:
Application
+
.NET Runtime
+
Dependencies
↓
Docker Image
↓
Docker Container
అందువల్ల environment consistency పెరుగుతుంది.
2. Docker ఎందుకు ఉపయోగిస్తారు?
Docker ప్రధానంగా:
- Environment consistency
- Application isolation
- Faster deployment
- Scalability
- Microservices
- CI/CD
- Cloud deployment
కోసం ఉపయోగిస్తారు.
3. Containerization అంటే ఏమిటి?
Applicationను దాని dependenciesతో కలిసి isolated environmentలో package చేసి run చేయడాన్ని Containerization అంటారు.
4. Docker మరియు Virtual Machine మధ్య తేడా ఏమిటి?
| Docker Container | Virtual Machine |
|---|---|
| Lightweight | Comparatively heavy |
| Host OS kernelను share చేస్తుంది | Complete guest OS ఉంటుంది |
| Fast startup | Slower startup |
| తక్కువ resources | ఎక్కువ resources |
| Secondsలో start అవుతుంది | Usually more overhead |
| Microservicesకు useful | Full OS isolation అవసరమైనప్పుడు useful |
సింపుల్గా:
VM
Hardware
↓
Host OS
↓
Hypervisor
↓
Guest OS
↓
Application
Docker:
Hardware
↓
Host OS
↓
Docker Engine
↓
Containers
↓
Applications
5. Docker Image అంటే ఏమిటి?
Docker Image అనేది containerను create చేయడానికి ఉపయోగించే read-only template.
Imageలో application మరియు దానికి అవసరమైన dependencies ఉంటాయి.
Example:
myapi:1.0
6. Docker Container అంటే ఏమిటి?
Docker Image యొక్క running instanceను Container అంటారు.
Docker Image
↓
docker run
↓
Docker Container
ఒకే image నుంచి multiple containers create చేయవచ్చు.
7. Docker Image మరియు Container మధ్య difference ఏమిటి?
Image = Template
Container = Running Instance
Example:
Image
↓
Container 1
Container 2
Container 3
8. Docker Engine అంటే ఏమిటి?
Docker Engine అనేది containersను build, run మరియు manage చేయడానికి ఉపయోగించే core Docker technology.
ఇది broadly:
Docker CLI
↓
Docker API
↓
Docker Engine
↓
Containers
వంటి architectureలో పనిచేస్తుంది.
9. Docker CLI అంటే ఏమిటి?
Docker CLI అంటే Docker Command Line Interface.
దీని ద్వారా Dockerను commands ద్వారా control చేయవచ్చు.
Example:
docker ps
docker images
docker build
docker run
docker stop
10. Docker Hub అంటే ఏమిటి?
Docker Hub అనేది Docker imagesను store మరియు share చేయడానికి ఉపయోగించే container registry service.
ఉదాహరణకు:
Developer
↓
docker push
↓
Docker Registry
↓
docker pull
↓
Server
Part 2: Docker Commands
11. Docker version ఎలా check చేయాలి?
docker version
లేదా:
docker --version
12. Docker images ఎలా చూడాలి?
docker images
Modern syntax:
docker image ls
13. Running containers ఎలా చూడాలి?
docker ps
14. Running మరియు stopped containers రెండింటినీ ఎలా చూడాలి?
docker ps -a
15. Docker Container ఎలా run చేయాలి?
docker run nginx
Backgroundలో run చేయడానికి:
docker run -d nginx
16. Containerకు పేరు ఎలా ఇవ్వాలి?
docker run --name mycontainer nginx
17. Docker Container ఎలా stop చేయాలి?
docker stop mycontainer
18. Docker Container ఎలా start చేయాలి?
docker start mycontainer
19. Container restart ఎలా చేయాలి?
docker restart mycontainer
20. Container remove ఎలా చేయాలి?
docker rm mycontainer
Running containerను forcefully remove చేయడానికి:
docker rm -f mycontainer
21. Docker Image ఎలా remove చేయాలి?
docker rmi image-name
లేదా:
docker image rm image-name
22. Docker Container logs ఎలా చూడాలి?
docker logs mycontainer
Live logs:
docker logs -f mycontainer
23. Running Container లో command ఎలా execute చేయాలి?
docker exec -it mycontainer bash
Alpine image అయితే:
docker exec -it mycontainer sh
24. Docker Container inspect ఎలా చేయాలి?
docker inspect mycontainer
ఇది container configuration, network, mounts వంటి details చూపిస్తుంది.
25. Docker system cleanup ఎలా చేయాలి?
Unused Docker resourcesను cleanup చేయడానికి:
docker system prune
Volumesను కూడా remove చేయాల్సి ఉంటే చాలా జాగ్రత్తగా:
docker system prune --volumes
Production environmentలో cleanup commands run చేసే ముందు ఏ resources remove అవుతాయో verify చేయాలి.
Part 3: Dockerfile
26. Dockerfile అంటే ఏమిటి?
Docker image build చేయడానికి instructions కలిగి ఉన్న text fileను Dockerfile అంటారు.
Example:
FROM nginx:alpine
COPY . /usr/share/nginx/html
EXPOSE 80
27. Dockerfileలో FROM అంటే ఏమిటి?
FROM base imageను specify చేస్తుంది.
Example:
FROM mcr.microsoft.com/dotnet/aspnet:9.0
28. RUN instruction అంటే ఏమిటి?
Image build సమయంలో command execute చేయడానికి RUN ఉపయోగిస్తారు.
Example:
RUN apt-get update
29. COPY అంటే ఏమిటి?
Host machine నుంచి filesను imageలోకి copy చేయడానికి COPY ఉపయోగిస్తారు.
COPY . /app
30. ADD మరియు COPY మధ్య difference ఏమిటి?
COPY files/directories copy చేయడానికి straightforward instruction.
ADD additional features కలిగి ఉంటుంది.
General best practice:
COPY
సాధారణ file copying కోసం prefer చేయడం మంచిది.
31. WORKDIR అంటే ఏమిటి?
Containerలో working directory set చేయడానికి WORKDIR ఉపయోగిస్తారు.
Example:
WORKDIR /app
తర్వాత commands ఆ directoryను default working directoryగా ఉపయోగిస్తాయి.
32. EXPOSE అంటే ఏమిటి?
Container ఏ network portను application ఉపయోగిస్తుందో document చేయడానికి:
EXPOSE 8080
ఉపయోగిస్తారు.
Important: EXPOSE host machineకు automatically port publish చేయదు.
33. CMD అంటే ఏమిటి?
Container start అయినప్పుడు default command specify చేయడానికి CMD ఉపయోగిస్తారు.
Example:
CMD ["dotnet", "MyApi.dll"]
34. ENTRYPOINT అంటే ఏమిటి?
Container యొక్క main executable/entry commandను define చేయడానికి ENTRYPOINT ఉపయోగిస్తారు.
Example:
ENTRYPOINT ["dotnet", "MyApi.dll"]
35. CMD మరియు ENTRYPOINT మధ్య difference ఏమిటి?
Simple interview answer:
ENTRYPOINT → container యొక్క main executable.
CMD → default arguments లేదా default command.
Example:
ENTRYPOINT ["dotnet"]
CMD ["MyApi.dll"]
36. Dockerfileలో ENV అంటే ఏమిటి?
Environment variable define చేయడానికి:
ENV ASPNETCORE_ENVIRONMENT=Production
ఉపయోగిస్తారు.
37. ARG అంటే ఏమిటి?
Docker image build సమయంలో build argument pass చేయడానికి ARG ఉపయోగిస్తారు.
ARG VERSION=1.0
Build:
docker build --build-arg VERSION=2.0 .
38. ARG మరియు ENV మధ్య difference ఏమిటి?
| ARG | ENV |
|---|---|
| Build-time variable | Environment variable |
| Image build సమయంలో ఉపయోగం | Container runtimeలో available |
| Build arguments pass చేయవచ్చు | Runtime configurationకు useful |
39. Docker image ఎలా build చేయాలి?
docker build -t myapi:1.0 .
ఇక్కడ:
-t → image name/tag
. → build context
40. Docker build context అంటే ఏమిటి?
docker build commandకు ఇచ్చిన directory లేదా contextలోని files Docker build processకు available అవుతాయి.
Example:
docker build -t myapi .
ఇక్కడ . current directory build context.
Part 4: Docker Layers
41. Docker Image Layers అంటే ఏమిటి?
Docker image అనేది multiple read-only layersతో నిర్మించబడుతుంది.
Example:
Application Layer
↓
Dependency Layer
↓
Runtime Layer
↓
Base Image Layer
42. Docker layers వల్ల ప్రయోజనం ఏమిటి?
Layers వల్ల:
- Image reuse
- Build caching
- Faster builds
- Storage efficiency
లభిస్తాయి.
43. Docker image cache అంటే ఏమిటి?
Docker previous build layersను cache చేసి unchanged instructions కోసం వాటిని reuse చేస్తుంది.
అందువల్ల subsequent builds వేగంగా complete అవుతాయి.
44. Dockerfile optimization ఎలా చేయాలి?
Common techniques:
- Smaller base image
- Multi-stage builds
.dockerignore- Layer ordering
- Dependency caching
- Unnecessary packages avoid చేయడం
45. Multi-stage Docker build అంటే ఏమిటి?
Application build మరియు runtime imagesను separate stagesగా ఉంచే technique.
.NET example:
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyApi.dll"]
దీంతో final imageలో SDK/build artifacts అవసరం లేకుండా runtime files మాత్రమే ఉంచవచ్చు.
46. Multi-stage build ఎందుకు ఉపయోగిస్తారు?
Main benefits:
- Smaller final image
- Better security posture
- Faster deployment
- Reduced attack surface
- Build dependencies final imageలో ఉండవు
47. .dockerignore అంటే ఏమిటి?
Docker build contextలో unnecessary files పంపకుండా ఉండటానికి .dockerignore ఉపయోగిస్తారు.
Example:
bin/
obj/
.git/
.vs/
*.user
48. Docker image tag అంటే ఏమిటి?
Image version లేదా variant identify చేయడానికి tag ఉపయోగిస్తారు.
Example:
myapi:1.0
myapi:2.0
myapi:latest
Production deploymentలో meaningful immutable version tags ఉపయోగించడం సాధారణంగా safer approach.
49. latest tag అంటే ఏమిటి?
latest అనేది special default tag name మాత్రమే; అది తప్పనిసరిగా newest image అని అర్థం కాదు.
Interviewలో ఇది important point.
50. Docker image ID అంటే ఏమిటి?
Image create అయినప్పుడు Docker దానికి unique identifier ఇస్తుంది.
docker image ls
ద్వారా image ID చూడవచ్చు.
Part 5: Docker Networking
Docker networking containers మధ్య communicationను enable చేస్తుంది. Composeలో ఒక applicationకు default network create చేయబడుతుంది మరియు అదే networkలోని services సాధారణంగా service name ద్వారా ఒకదానిని ఒకటి discover చేయగలవు.
51. Docker Network అంటే ఏమిటి?
Containers మరియు external systems మధ్య communication కోసం Docker networking ఉపయోగిస్తారు.
52. Docker network list ఎలా చూడాలి?
docker network ls
53. Docker network create ఎలా చేయాలి?
docker network create mynetwork
54. Containerను networkకు connect ఎలా చేయాలి?
docker network connect mynetwork mycontainer
55. Dockerలో default network types ఏమిటి?
Common network drivers:
- bridge
- host
- none
- overlay
- macvlan
Use case ఆధారంగా network driver choose చేస్తారు.
56. Bridge network అంటే ఏమిటి?
Single Docker hostలో containers communicate చేయడానికి commonly ఉపయోగించే network type.
57. Host network అంటే ఏమిటి?
Container host network stackను directly use చేసే networking mode.
Linux environmentsలో ఇది container isolation/network behaviorపై ప్రభావం చూపుతుంది.
58. Overlay network అంటే ఏమిటి?
Multiple Docker hosts మధ్య containers/services communicate చేయడానికి overlay networking ఉపయోగించవచ్చు.
ఇది distributed container environmentsలో useful.
59. Container-to-container communication ఎలా జరుగుతుంది?
Same Docker networkలో containers service/container name ద్వారా communicate చేయగలవు.
Example:
API Container
↓
http://database:5432
ఇక్కడ database hostnameగా పని చేయవచ్చు.
60. Port mapping అంటే ఏమిటి?
Host portను container portకు map చేయడాన్ని port mapping అంటారు.
docker run -p 8080:80 nginx
Meaning:
Host:8080
↓
Container:80
Part 6: Docker Volumes
61. Docker Volume అంటే ఏమిటి?
Container lifecycleకు independentగా persistent data store చేయడానికి Docker volumes ఉపయోగిస్తారు.
Docker documentation ప్రకారం volumes container engine ద్వారా managed persistent data storesగా పనిచేస్తాయి.
62. Volumes ఎందుకు అవసరం?
Container delete చేసినా data retain చేయడానికి volumes ఉపయోగిస్తారు.
Example:
Database Container
↓
Docker Volume
↓
Persistent Data
63. Volume create ఎలా చేయాలి?
docker volume create myvolume
64. Volumes list ఎలా చూడాలి?
docker volume ls
65. Volume inspect ఎలా చేయాలి?
docker volume inspect myvolume
66. Volume containerకు ఎలా mount చేయాలి?
docker run \
-v myvolume:/data \
myimage
67. Bind Mount అంటే ఏమిటి?
Host machine directoryను container directoryకి directly mount చేయడం bind mount.
Example:
docker run -v C:\myapp:/app myimage
Development environmentsలో ఇది useful.
68. Volume మరియు Bind Mount మధ్య difference ఏమిటి?
| Volume | Bind Mount |
|---|---|
| Docker-managed | Host path managed |
| Persistent data కోసం useful | Host files share చేయడానికి useful |
| Docker storage area | Specific host directory |
| Production data కోసం common | Developmentలో common |
69. Container delete చేస్తే volume delete అవుతుందా?
సాధారణంగా container remove చేయడం వల్ల named volume automatically remove కాదు.
అందుకే persistent data container lifecycleకు independentగా ఉండవచ్చు.
70. Databaseను Docker containerలో run చేయవచ్చా?
అవును.
Examples:
SQL Server
PostgreSQL
MySQL
MongoDB
Redis
వంటి databases containersలో run చేయవచ్చు.
Productionలో persistent storage, backup, security, upgrade strategy తప్పనిసరిగా consider చేయాలి.
Part 7: Docker Compose
Docker Compose ఒక YAML file ద్వారా multi-container applicationsను define మరియు run చేయడానికి ఉపయోగిస్తారు. Current Compose Specification services, networks, volumes, configs, secrets వంటి conceptsను support చేస్తుంది.
71. Docker Compose అంటే ఏమిటి?
Multiple containersను ఒక application stackగా manage చేయడానికి Docker Compose ఉపయోగిస్తారు.
Example:
Frontend
Backend API
Database
Redis
Message Broker
వీటిని ఒక Compose fileలో define చేయవచ్చు.
72. Compose file అంటే ఏమిటి?
Compose application configuration సాధారణంగా:
compose.yaml
లో define చేస్తారు.
Legacy projectsలో:
docker-compose.yml
కూడా కనిపించవచ్చు.
73. Docker Compose basic example
services:
api:
build: .
ports:
- "8080:8080"
database:
image: postgres:latest
environment:
POSTGRES_PASSWORD: example
74. Docker Compose application ఎలా start చేయాలి?
docker compose up
Background mode:
docker compose up -d
75. Compose services stop ఎలా చేయాలి?
docker compose stop
76. Compose application shutdown ఎలా చేయాలి?
docker compose down
down servicesతో పాటు Compose-created networks వంటి resourcesను remove చేయగలదు.
77. docker compose up మరియు docker compose run మధ్య difference ఏమిటి?
docker compose up:
Complete application/services
start చేయడానికి.
docker compose run:
One-off command
run చేయడానికి.
Docker documentation కూడా up మొత్తం servicesను start చేయడానికి, run ఒక service కోసం one-off task execute చేయడానికి ఉపయోగిస్తుందని వివరిస్తుంది.
78. Docker Composeలో environment variables ఎలా pass చేయాలి?
Example:
services:
api:
environment:
ASPNETCORE_ENVIRONMENT: Production
.env file ద్వారా కూడా configuration values manage చేయవచ్చు.
79. Composeలో service dependency ఎలా define చేయాలి?
services:
api:
depends_on:
- database
database:
image: postgres
కానీ depends_on alone database application-ready అయిందని guarantee చేయదు.
Health checks ఉపయోగించడం better approach.
80. Docker Compose Healthcheck అంటే ఏమిటి?
Service healthy stateలో ఉందా లేదా check చేయడానికి healthcheck ఉపయోగిస్తారు.
Example:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
Docker Compose documentation startup race conditionsను handle చేయడానికి health checks ఉపయోగించవచ్చని చూపిస్తుంది.
Part 8: Docker + .NET
81. ASP.NET Core applicationను Dockerize ఎలా చేయాలి?
Typical process:
.NET Application
↓
Dockerfile
↓
docker build
↓
Docker Image
↓
docker run
↓
Container
82. .NET application కోసం Dockerfile example ఇవ్వండి
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyApi.dll"]
83. .NET SDK image మరియు ASP.NET runtime image మధ్య difference ఏమిటి?
SDK image:
Application build/publish చేయడానికి.
ASP.NET runtime image:
Published ASP.NET Core application run చేయడానికి.
Production final stageలో runtime image ఉపయోగించడం వల్ల image size మరియు unnecessary build dependencies తగ్గించవచ్చు.
84. ASP.NET Core Docker containerలో port ఎలా configure చేయాలి?
Dockerfile:
EXPOSE 8080
Run:
docker run -p 8080:8080 myapi
85. Docker containerలో ASP.NET Core environment ఎలా set చేయాలి?
docker run \
-e ASPNETCORE_ENVIRONMENT=Production \
myapi
86. Docker Composeలో .NET API + SQL Server ఎలా configure చేయాలి?
Example:
services:
api:
build: .
ports:
- "8080:8080"
depends_on:
- sqlserver
sqlserver:
image: mcr.microsoft.com/mssql/server
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "YourStrongPassword"
Real production systemsలో credentials plain text Compose filesలో ఉంచకుండా secure secret/configuration mechanism ఉపయోగించడం మంచిది.
87. Dockerలో appsettings.json ఎలా manage చేయాలి?
Environment-specific configuration కోసం:
Environment Variables
↓
appsettings
↓
Secret Management
వంటి approaches ఉపయోగించవచ్చు.
Production secretsను source code లేదా Dockerfileలో hard-code చేయకూడదు.
88. Dockerలో ASP.NET Core logs ఎలా చూడాలి?
docker logs myapi
Compose:
docker compose logs api
Live:
docker compose logs -f api
Part 9: Docker Security
89. Docker security ఎందుకు ముఖ్యమైనది?
Containers production workloadsను run చేస్తాయి కాబట్టి:
- Vulnerable packages
- Excessive privileges
- Secret exposure
- Unsafe images
- Misconfigured networks
వంటి issuesను prevent చేయాలి.
90. Docker image security ఎలా improve చేయాలి?
Best practices:
- Trusted base images ఉపయోగించాలి.
- Images regularly update చేయాలి.
- Vulnerability scanning చేయాలి.
- Unnecessary packages remove చేయాలి.
- Non-root userతో application run చేయాలి.
- Secrets imageలో hard-code చేయకూడదు.
- Minimal runtime images ఉపయోగించాలి.
91. Containerను root userతో run చేయడం ఎందుకు avoid చేయాలి?
Application compromise అయితే excessive privileges misuse అయ్యే risk ఉంటుంది.
అందుకే possible అయితే non-root userతో run చేయడం better.
Dockerfile example:
USER app
92. Docker secrets అంటే ఏమిటి?
Passwords, certificates, tokens వంటి sensitive informationను safer wayలో provide చేయడానికి secrets mechanism ఉపయోగించవచ్చు.
Secretsను Dockerfileలో ఇలా పెట్టడం avoid చేయాలి:
ENV PASSWORD=MyPassword
93. Docker image scanning అంటే ఏమిటి?
Container imageలో known vulnerabilities ఉన్నాయా అని check చేయడాన్ని image scanning అంటారు.
CI/CD pipelineలో image scan stage add చేయవచ్చు.
94. Dockerfileలో secrets ఎందుకు పెట్టకూడదు?
Dockerfile:
ENV API_KEY=123456
లేదా:
COPY secret.txt /app
వంటి approaches sensitive informationను image history/layersలో expose చేసే అవకాశం కలిగిస్తాయి.
Secretsను secure secret-management solution ద్వారా inject చేయడం better.
Part 10: Docker Registry
95. Container Registry అంటే ఏమిటి?
Docker imagesను store, version మరియు distribute చేయడానికి container registry ఉపయోగిస్తారు.
Examples:
Docker Hub
Azure Container Registry
GitHub Container Registry
Amazon ECR
Google Artifact Registry
96. Azure Container Registry అంటే ఏమిటి?
Azure Container Registry (ACR) అనేది Azureలో private container imagesను store మరియు manage చేయడానికి ఉపయోగించే registry service.
Typical architecture:
Developer
↓
Docker Build
↓
Docker Image
↓
Azure Container Registry
↓
AKS / App Service / Container Apps
97. Docker imageను registryకి ఎలా push చేయాలి?
General flow:
docker login
Image tag:
docker tag myapi:1.0 registry.example.com/myapi:1.0
Push:
docker push registry.example.com/myapi:1.0
98. Docker మరియు Kubernetes మధ్య difference ఏమిటి?
Docker ప్రధానంగా:
Container Build
Container Run
Container Management
కోసం.
Kubernetes:
Container Orchestration
Scaling
Service Discovery
Rolling Deployment
Self Healing
వంటి large-scale orchestration needs కోసం.
Simple interview answer:
Docker creates and runs containers; Kubernetes orchestrates containers at scale.
99. Docker మరియు Kubernetes కలిసి ఎలా ఉపయోగిస్తారు?
Typical enterprise flow:
Developer
↓
Source Code
↓
Docker Build
↓
Docker Image
↓
Container Registry
↓
Kubernetes / AKS
↓
Pods
↓
Application
ఉదాహరణకు Azure environmentలో:
.NET Microservice
↓
Docker Image
↓
Azure Container Registry
↓
Azure Kubernetes Service
↓
Pods
100. Real-Time Interview Scenario: Docker container productionలో crash అయితే ఏమి చేస్తారు?
ఇది చాలా ముఖ్యమైన scenario-based interview question.
మొదట:
docker ps -a
తో container status check చేస్తాను.
తర్వాత:
docker logs container-name
తో logs check చేస్తాను.
తర్వాత:
docker inspect container-name
తో configuration, environment, mounts, network వంటి details verify చేస్తాను.
Resource issue ఉందా అని:
docker stats
check చేస్తాను.
Healthcheck ఉంటే container health status కూడా verify చేస్తాను.
Problem గుర్తించిన తర్వాత:
Application Issue
↓
Configuration Issue
↓
Dependency Issue
↓
Resource Issue
↓
Network Issue
↓
Image Issue
అనేది isolate చేస్తాను.
Productionలో restart policy, health checks, centralized logging, monitoring మరియు orchestration platform ఉంటే వాటిని కూడా use చేస్తాను.
Bonus: Top 20 Scenario-Based Docker Interview Questions
Scenario 1: Container immediately exits. Why?
Possible reasons:
- Application crashed
- Incorrect ENTRYPOINT
- Incorrect CMD
- Missing dependency
- Configuration issue
Check:
docker logs container
Scenario 2: Container running but API not accessible. What do you check?
Check:
Application listening port
↓
EXPOSE
↓
Port mapping
↓
Docker network
↓
Firewall
Example:
docker run -p 8080:8080 myapi
Scenario 3: Container data disappeared after restart. Why?
Data may have been stored inside the container writable layer.
Solution:
Docker Volume
use చేయాలి.
Scenario 4: Docker image size is very large. How do you reduce it?
Use:
- Multi-stage build
- Smaller base image where appropriate
.dockerignore- Remove unnecessary dependencies
- Runtime-only final image
Scenario 5: Docker build is very slow. What do you do?
Check:
- Build context
.dockerignore- Layer ordering
- Cache usage
- Dependency restore steps
Example:
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release
Dependency files unchangedగా ఉంటే earlier layer cache reuse అయ్యే అవకాశం ఉంటుంది.
Scenario 6: Two containers cannot communicate. What do you check?
Check:
Same network?
Correct hostname?
Correct container port?
Application listening on correct interface?
Firewall/network rules?
Scenario 7: API container cannot connect to database container. Why?
A common mistake:
localhost
ని database hostnameగా use చేయడం.
Containerలో localhost అంటే అదే container.
Compose networkలో database service పేరు:
database
అయితే connection string:
Server=database;
వంటి configuration అవసరం కావచ్చు.
Scenario 8: How do you pass configuration without rebuilding image?
Use:
Environment Variables
or external configuration/secrets mechanisms.
Example:
docker run -e ASPNETCORE_ENVIRONMENT=Production myapi
Scenario 9: How do you deploy a new Docker version without changing application code?
Build new image:
docker build -t myapi:2.0 .
Push:
docker push registry/myapi:2.0
Deployment platformలో image version:
myapi:1.0
↓
myapi:2.0
update చేయాలి.
Scenario 10: Why shouldn’t we use latest in production?
latest tag mutable కావచ్చు.
Productionలో:
myapi:2026.08.20
లేదా immutable digest/version strategy ఉపయోగించడం deployment traceability మరియు rollbackకు better.
Scenario 11: How do you implement rollback?
Previous image version retain చేయాలి.
Example:
Version 3.0 → Problem
↓
Rollback
↓
Version 2.0
Kubernetes/CI-CD platformsలో previous deployment revision/image versionను redeploy చేయవచ్చు.
Scenario 12: How do you scale containers?
Docker Composeలో service scaling support ఉంది.
Example:
docker compose up --scale api=3
Large production workloadsలో Kubernetes/AKS వంటి orchestration platform సాధారణంగా more appropriate.
Scenario 13: What happens if Docker host crashes?
Single-host Docker deploymentలో containers కూడా unavailable అవుతాయి.
Productionలో high availability కోసం:
Multiple Nodes
↓
Load Balancer
↓
Container Orchestrator
వంటి architecture ఉపయోగించవచ్చు.
Scenario 14: How do you monitor Docker containers?
Monitor:
- CPU
- Memory
- Network
- Disk
- Logs
- Container health
- Restart count
Basic command:
docker stats
Scenario 15: How do you troubleshoot high CPU?
First:
docker stats
Check చేయాలి.
తర్వాత:
Application logs
Application metrics
Thread usage
Database calls
Infinite loops
High traffic
వంటి root causes investigate చేయాలి.
Scenario 16: How do you troubleshoot high memory?
Check:
docker stats
తర్వాత application memory usage, leaks, caching, large payloads మరియు container limits verify చేయాలి.
Scenario 17: How do you make Docker deployment secure?
Follow:
Trusted Images
↓
Minimal Images
↓
Non-root User
↓
Secret Management
↓
Image Scanning
↓
Network Isolation
↓
Least Privilege
↓
Monitoring
Scenario 18: Docker Composeలో multiple environments ఎలా manage చేస్తారు?
Example:
compose.yaml
compose.dev.yaml
compose.prod.yaml
Additional Compose filesను combine చేసి environment-specific configuration override చేయవచ్చు. Docker Compose multiple files support చేస్తుంది మరియు later files earlier configurationను override/add చేయగలవు.
Scenario 19: Productionలో Docker Compose ఉపయోగించవచ్చా?
అవును.
Docker documentation ప్రకారం Compose single-server production deploymentsలో ఉపయోగించవచ్చు; larger scale అవసరమైతే Swarm వంటి cluster-based approach ఉపయోగించవచ్చు.
అయితే enterprise requirements ప్రకారం Kubernetes/AKS వంటి orchestration platform కూడా ఉపయోగించవచ్చు.
Scenario 20: Explain complete Docker CI/CD architecture.
Strong interview answer:
Developer
↓
Git Repository
↓
CI Pipeline
↓
Build .NET Application
↓
Docker Build
↓
Docker Image
↓
Security Scan
↓
Container Registry
↓
CD Pipeline
↓
Deployment
↓
Kubernetes / AKS / App Service
↓
Monitoring
ఉదాహరణకు Azure environment:
Azure DevOps
↓
Build Pipeline
↓
Docker Build
↓
Azure Container Registry
↓
Azure Kubernetes Service
↓
Pods
↓
Azure Monitor / Application Insights
Docker Interviewలో తప్పక గుర్తుంచుకోవాల్సిన 15 Points
1.
Image = Template
2.
Container = Running instance of image
3.
Dockerfile = Image build instructions
4.
Compose = Multi-container application definition and management
5.
Volume = Persistent data
6.
Network = Container communication
7.
Registry = Image storage/distribution
8.
ENTRYPOINT = Main executable
9.
CMD = Default command/arguments
10.
EXPOSE ≠ Port publishing
11.
-p 8080:80 = Host port 8080 → Container port 80
12.
Multi-stage build = Smaller production image
13.
.dockerignore = Reduce build context
14.
Don’t hard-code secrets in Dockerfile
15.
Production deployments need versioned images, health checks, monitoring and rollback strategy
Final Docker Interview Preparation Strategy
Docker interview preparationను ఈ orderలో చేస్తే easyగా remember చేయవచ్చు:
Docker Basics
↓
Images
↓
Containers
↓
Dockerfile
↓
Docker Commands
↓
Layers
↓
Networking
↓
Volumes
↓
Docker Compose
↓
Docker Security
↓
Docker Registry
↓
.NET Dockerization
↓
CI/CD
↓
Kubernetes
↓
Real-Time Scenarios
Conclusion
Docker అనేది కేవలం docker run command తెలుసుకోవడం మాత్రమే కాదు. Senior .NET Developer / Tech Lead / Solution Architect interviewsలో Docker + Microservices + CI/CD + Azure + Kubernetes combinationపై scenario-based questions ఎక్కువగా ఎదురవుతాయి.
అందువల్ల interview కోసం ముఖ్యంగా:
Dockerfile + Multi-stage Build + Networking + Volumes + Compose + Registry + Security + CI/CD + Kubernetes integration
పై strong understanding ఉండాలి.
Docker Compose current documentation ప్రకారం multi-container applicationsను YAML-based configuration ద్వారా define చేసి lifecycle manage చేయడానికి ఉపయోగపడుతుంది; services, networks, volumes మరియు secrets వంటి conceptsను ఒకే application modelలో manage చేయవచ్చు.
ఈ 100 questionsను basic questions మాత్రమే కాకుండా real-time production scenariosతో practice చేస్తే Docker interviewsకు మంచి preparation అవుతుంది.
Official Docker Documentation
Docker యొక్క official documentationలో Docker concepts, Dockerfile, Compose, networking, volumes మరియు CLI reference గురించి తాజా information అందుబాటులో ఉంది.
