What is Docker?
Docker is a platform that lets you package your applications and all their dependencies into a single container so they run consistently across different environments.
it provide better approach to create and manage build to any platform
Think of it like this:
-
Without Docker: "It works on my machine" problem happens because environments differ.
-
With Docker: You send the same container image that runs exactly the same everywhere — laptop, server, or cloud.
Key points:
-
Image = Blueprint/template of your app.
-
Container = Running instance of that image.
-
Dockerfile = Script with instructions to build an image.
Registry – Storage for images (Docker Hub, AWS ECR, Azure ACR)
-
Volume – Persistent storage for containers
-
Network – Communication between containers
2. Install Docker on Windows
-
Check your Windows Version
Docker Desktop works best on Windows 10/11 Pro/Enterprise (with WSL2).
If you have Windows Home, it also works but WSL2 is required. -
Download Docker Desktop
-
Go to Docker official site
-
Download Docker Desktop for Windows.
-
-
Install Docker Desktop
-
Run the installer.
-
Make sure "Use WSL 2 instead of Hyper-V" is checked (for most systems).
-
Follow prompts and restart if required.
-
-
Enable WSL 2 (if not already)
-
Open PowerShell (Admin) and run:
-
Restart your system.
-
-
Verify Docker Installation
Open Command Prompt or PowerShell:You should see something like:
3. Basic Docker Commands
3. Simple Example: Create & Build with Docker
We’ll create a simple Hello World Python app and run it in Docker.
Step 1 — Create a project folder
Step 2 — Create app.py
Step 3 — Create Dockerfile
Step 4 — Build the Docker Image
Here:
-
-t my-python-app
= Tag/name for your image. -
.
= Build from current folder.
Step 5 — Run the Docker Container
You should see:
Comments
Post a Comment
POST Answer of Questions and ASK to Doubt