Mr. Deepak Verma
Web Developer
Docker Image क्या होती है?

Learn Docker by M-Learnify

Docker

Docker Image क्या होती है?


Docker Image क्या होती है?

Docker Image क्या होती है?

Docker Image एक ब्लूप्रिंट (template) होती है, जिससे container बनाया जाता है। आप इसे ऐसे समझ सकते हैं — जैसे किसी इमारत को बनाने से पहले उसका नक्शा (blueprint) तैयार किया जाता है, उसी तरह किसी container को चलाने से पहले उसकी image तैयार की जाती है।

Docker Image में क्या होता है?

एक Docker Image में वह सब कुछ होता है जो किसी Application को चलाने के लिए आवश्यक होता है:

  • Application का कोड
  • जरूरी Libraries और Dependencies
  • Configuration Files
  • Base OS Files (जैसे: Ubuntu, Alpine, Debian आदि)

Image और Container का रिश्ता

तुलना Docker Image Docker Container
Nature Static (Fixed) Running (Live)
क्या है? Blueprint / Template Running instance of image
Example nginx:latest वह nginx server जो चल रहा है
कमांड docker pull docker run

उदाहरण

# Nginx image डाउनलोड करना
docker pull nginx

# Image से container बनाना और चलाना
docker run -d -p 8080:80 nginx
ऊपर दिए उदाहरण में nginx एक Docker Image है, और उससे जो server चल रहा है — वही Docker Container कहलाता है।

Image कैसे बनती है?

Docker Image आम तौर पर एक Dockerfile से बनाई जाती है। यह एक साधारण text file होती है जिसमें लिखा होता है कि Image कैसे तैयार करनी है।

# बेस image
FROM python:3.9

# Working directory सेट करें
WORKDIR /app

# Code copy करें
COPY . /app

# Dependencies install करें
RUN pip install -r requirements.txt

# App चलाने की command
CMD ["python", "app.py"]

फिर इसे build करने के लिए यह कमांड चलाते हैं:

docker build -t my-python-app .
⚠️ सावधानी: Dockerfile उसी डायरेक्टरी में होनी चाहिए जहाँ से आप build कमांड चला रहे हैं। वरना build process असफल हो सकता है।
संक्षेप में:

Docker Image = Container का ब्लूप्रिंट
इसमें App + Dependencies + Configuration शामिल होते हैं
Image से ही Container बनता और चलता है
Image को आप share भी कर सकते हैं (Docker Hub या private registry में)
← Back to Courses
Course Lessons