README
তুমি যদি Docker জানো, তুমি হিরো!"
ইয়া হু হু হু ! তুমি কি প্রস্তুত? তোমরা যারা কোডিং করো, তাদের জন্য একটা গোপন অস্ত্র আছে, আর সেটা হলো Docker! তুমি কি জানো, কেন এটা এত জনপ্রিয়? কারণ এটা এমন এক “কনটেইনার ম্যাজিক”, যেটা দিয়ে তুমি তোমার কোডকে এমনভাবে প্যাক করতে পারবে যে পৃথিবীর যেকোনো pc তে রান করতে পারবা!
কেন Docker তোমার জন্য ভীষণ দরকার?
Docker বললে কি মনে আসে? আমার মনে আসে সেই ছোটবেলার বিখ্যাত ব্যাকপ্যাক! তুমি যা কিছু চাও সব এক্সট্রা, সবকিছু ঠেসে ঢুকিয়ে নাও, তারপর দৌড়ে বেরিয়ে পড়ো। Dockerও ঠিক তাই! তুমি অ্যাপ্লিকেশন প্যাক করবে, সবকিছু পুটুস পুটুস ঢুকাবে, তারপর যেকোনো জায়গায় নিয়ে গিয়ে তা সহজেই চালাতে পারবে। আর এটাই হলো Docker এর ম্যাজিক! তুমি একবার শিখলে, সারাজীবন স্কিল পয়েন্ট বয়ে বেড়াবে। মাথার মধ্যে সবসময় বাজবে, "ঐ মামা! তুমি Docker কেনো ইউজ করো না?"
এই মডিউলে তোমরা যা শিখবেঃ
১-১ Get Started With Docker
- তুমি যদি কখনো ভেবেছো Docker কীভাবে কাজ করে, তাহলে এই ভিডিও তোমার জন্য। একদম শুরু থেকে শুরু করবো। চোখ খুলে রাখো, কারণ মজার কিছু জিনিস দেখার জন্য প্রস্তুত হয়ে যাও!
১-২ What is Docker & Why?
- Docker কি? কেন এটা নিয়ে সবাই এমন হাইপে থাকে? কারণ এটা তোমার কোডিং লাইফকে করবে সুপার ফাস্ট, সুপার স্মুথ! একেবারে ম্যাজিক!
১-৩ Virtual Machine vs Docker Containers
- এইটা বুঝার পর তুমি বলে দিবে—VM তো পুরাতন খবর মামা! Docker হলো আসল হিরো, কন্টেইনারের ফ্লেক্সিবলিটি পেয়ে তুমি আর পিছে ফিরে তাকাবে না।
১-৪ Docker Setup
- তো, কিভাবে সেটআপ করবে এই জাদুকরী টুল? এটা একদম সহজ! একবার সেটআপ হয়ে গেলে, তোমার মেশিন হয়ে যাবে একদম Docker-prepared! 🚀
১-৫ Docker Installation [Windows]
- Windows ইউজাররা! তোমার জন্য আলাদা টিউটোরিয়াল, একদম হ্যান্ডস-অন! নিজের হাতে Docker সেটআপ করো, আর কোডিংয়ের মাঠে ঝাঁপিয়ে পড়ো।
১-৬ Docker Installation [Mac]
- Mac ইউজারদের জন্য? চিন্তা নাই মামা, Mac-এ ও Docker ইনস্টল করা একদম পানির মতো সহজ!
১-৭ Docker Installation [Linux]
- Linux দুনিয়ার হ্যাকার ফ্রেন্ডরা! তোমাদের জন্যও পুরো ইনস্টল গাইডলাইন। একবার Linux-এ Docker সেটআপ করো, তারপর তো "এই পাখি উড়ে যাবে দূর"। 🐧
১-৮ Overview of Docker Tools
Docker তো শুধু একটা জিনিস না, সাথে থাকে আস্ত টুলবক্স! এসব টুলের সাথেও তোমার পরিচয় করিয়ে দিবো। পরে এগুলা চালিয়ে যাও মনের সুখে!
১-৯ Configuring VS Code & Creating The First Container
-
এখন তোমার সেরা কোড এডিটর VS Code-এ Docker চালানো শিখবো। আর প্রথম কন্টেইনার বানানো? এটা একদম প্রথমবারের মত সাইকেল চালানোর মতো—একবার শিখে নিলে জীবনে ভুলবে না!
-
এই পুরো কোর্সে শুধু তোমার প্রজেক্ট নয়, তোমার আত্মবিশ্বাসও ডেভেলপ হবে! Docker হলো সেই টুল, যা তোমাকে তোমার ফিউচার জব মার্কেটে একটা লেভেল আপ দিবে।তোমার Docker জার্নি একদম শুরুর দিকে, কিন্তু এটা তোমাকে তোমার পরবর্তী ক্যারিয়ারের পথে আরও এগিয়ে নিয়ে যাবে। Let’s Dockerize your dreams! Keep pushing, keep learning, কারণ তুমি পারবে!
-
GitHub Link: https://github.com/Apollo-Level2-Web-Dev/first-docker-container
-
WSL Cheat Sheet: https://find-saminravi99.notion.site/WSL-Cheat-Sheet-10dc48b8ac8c800eb30ec02c8d0507d5?pvs=4
WSL Cheat Sheet
Checking WSL Installation
-
List Installed Distributions:
wsl --list --all -
List Running Distributions:
wsl --list --running -
Check Available Online Distributions:
wsl --list --online -
Check WSL Version:
wsl --list --verbose -
Check if WSL Feature is Enabled:
dism.exe /Online /Get-Feature /All | find "Microsoft-Windows-Subsystem-Linux"
Installing a New Distribution
-
Install a Distribution: (Replace
<distro-name>with the name of the distribution, e.g.,Ubuntu.)wsl --install -d <distro-name>
Uninstalling a Distribution
-
Unregister (Uninstall) a Distribution:
wsl --unregister <distro-name> -
Check for Remaining Files:
- Path:
C:\\Users\\<your-username>\\AppData\\Local\\Packages\\<distro-folder>\\LocalState\\ - Ensure no
.vhdxfiles remain.
- Path:
Uninstalling WSL Completely
- Remove Installed Distributions:
- Go to Settings → Apps → Apps & Features and uninstall each distribution.
- Disable WSL Feature:
- Open Windows Features (
optionalfeatures.exe). - Uncheck Windows Subsystem for Linux and Virtual Machine Platform (if applicable).
- Open Windows Features (
- Remove WSL Kernel Update:
- Go to Settings → Apps → Apps & Features and uninstall Windows Subsystem for Linux Update.
Starting WSL
-
Open a Distribution:
wsl -d <distro-name> -
Open from Start Menu:
- Search for the distribution (e.g., Debian, Ubuntu) in the Start Menu.
Logging Out of WSL
-
Logout Command: or
exitlogout
Terminating WSL
-
Terminate a Running Distribution:
wsl --terminate <distro-name>
Additional Tips
- To update your WSL kernel manually, you can check Microsoft's WSL documentation for the latest version.
1-1 Get Started With Docker
- Its all about making a complex application portable so that it can be run in any environment without any compatibility issues.
1-2 What is Docker & Why?
- Docker is a container technology. A Tool For Creating and Managing Container.
What is Container?
-
Container is a Standardized Unit of software : A Package of code and dependencies to run that code( eg. nodejs code + nodejs runtime + tools + environment) #### Why Container?
- When we do a code contenization , The same container always yields the exact same application and execution behaviour! No matter where or by whome it might be executred.
-
If I have docker in my machine then we do not think about which version and dependencies are installed in my machine. Because docker container has its own dependencies and version.
-
here the version does not matter. When we make a containerized version here version is mentioned and the docker handles it(environment, dependencies).
1-3 Virtual Machine vs. Docker Containers
-
Virtual Machine Is a machine that runs virtually on top of host operating system. This is one kind of physical computer but this has no existance.
-
Suppose we have both linux and windows. both works seperaterly and has no communication between them. The virtual machine works in the same isoloated way.
-
we can do the works of docker using virtual machine. Its like we have created a project in virtual machine and shared within the employyes and they will will run the project in the same virtual machine. The main problem is its isolated.
-
Then why we do not use virtual machine instead of docker? : We can create a project keep the libraries dependencies tols and shate the os. The problem is we can create one project in one virtual machine but we need to work in multiple projects and for each project we need one virtual machine which will cause storage shortage.How Docker helps? : docker works in the same way in our operating system using docker engine. The key differences in docker is not creating any seperate operating system. for this reason storage for operating system is not required. Basically for a project we are making a container and string the libraries tools and dependencies and the container will hold the project. we can create multiple container for multiple projects and share to everyone in form of image which is docker term. when a project is not needed we can delete the container. again we can get the project project by using the image. In case of virtual machine if we delete a project we will have to build the same project in the virtual machine from scratch.
1-4 Docker Setup
- If docker installation matches pc requirment we can install docker desktop
- If Requirement does not match we can Install Docker Toolbox
- If we are linux user we need none of these because linux supprts docker by default and docker runs on linux environment. we will directly install docker engine in linux and using the terminal we can use it.
1-5 Docker Installation [Windows]
- for installing the docker we need wls - windows subsystem for linux, hyper-v because we know docker works in linux environment so by default linux supports docker but the windows is not a part or related to linux operating system. wls - windows subsystem for linux, hyper-v using these we are able to install in windows.
- in search bar we will search features -> turn windows features on or off ->

- after this we will tick the windows subsystem for linux and vitual machine platform
- Restart is required
Wsl Install
- there is a documantion of microsoft wor installing for wsl
- in powershell
wsl --install
- This will by default install ubuntu but we will install Debian
wsl --install -d Debian
- register using password
username : sazid
passowrd :
- for logout
exit
- now download the docker
- dwonload and install
docker --version
- it will show docker
docker --help
- this will show all docker commands
1-7 Docker Installation [Linux]
- Leyts install docker in ubuntu
-
the confusion is what should we install? docker engine or docker desktop.
-
Docker engine is the thing that docker runs behind the scene (docker core)
-
Docker Descktop is just a Docker GUI
-
The situation is like we are connection with the server through terminal in here docker engine is required.
-
If we want to see in gui then we will use the docker desktop
-
first we will install the engine
Installation Steps
- we need to install genome terminal for this
sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
- clear all dependencies
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
- Install the latest version
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- lets check
docker --version
- see the running process
sudo docker ps
sudo docker run hello-world
-
First it will see if available it will run if not available it will try to pull
-
Docker engine installion done
Lets install the gui for ubuntu
- install the genome terminal
sudo apt install gnome-terminal
- download the DEB package
sudo apt-get update
sudo apt-get install ./docker-desktop-amd64.deb
- then from the forlder open the terminal and install it
sudo apt-get install ./docker-desktop-amd64.deb
- By default we wneed to write
sudo docker ps
- if we write only
docker ps
-
it will not run
-
if it does not run even after writing sudo we have to write
sudo dockerd
-
this will run the docker demon
-
by default docker gets bind with the unix socket for this reason it is just accessable with the root user only
-
so we need to do some post installtion if we need to run the docker in pc startup
1-8 Overview of Docker Tools
-
For Using Docker we must need is Docker Engine which runs in linux. For this reason in our windows we have installed the virtual machine (debian) as windopws do not support linux environment and docker runs in linux environment. Linux just needs the docker engine
-
For sharing works with the teammates Docker Hub. This for collaboritive works like github
-
A project might have frontend and backend, database container. For keeping all in a manageable state we use Docker Compose
1-9 Configuring VS Code & Creating The First Container
- lets do the magic with the docker
Dockerfile
-
add docker file in root
-
inside the file
Use the official Node.js 20 image as the base image
FROM node:20
Set the working directory inside the container
All subsequent commands will run from this directory
WORKDIR /app
Copy only package.json first
This allows Docker to cache npm install if dependencies don’t change
COPY package.json .
Install all project dependencies
RUN npm install
Copy the rest of the application source code
COPY . .
Expose port 5000 to allow external access to the app
EXPOSE 5000
Define the command to start the application
Runs app.mjs using Node.js when the container starts
CMD ["node", "app.mjs"]
- now make a image for the container
docker build .
-
we have to define the port that means using the 5000 port run inside the container
-
Containetr is an isolated environment and with the container our system has not connection
-
To communicate with the container we have to define the port that server should run

-
using the image id run the project
docker run -p 5000:5000 sha256:d029c9c813f65cf837a542f0c5296bf5bef106fb8f496b70e422c7721984045f
- -p represents the port connection

- We didnt have to install anything but we have run the project using the docker
- for stopping the container we have to stop the container from the docker app

- just hit the stop button
- re-initialized docker learning