docker-images-vs-containers-complete-beginners-guide
What is the docker, and how would you use it in a system engineering role
?
Docker is a platform that allows developers and
system administrators to package applications and their
dependencies into containers. Containers are lightweight,
portable and run consistently across different computing environment.
How docker is used in system engineering:
1. Containerization:
Docker packages an application with all its dependencies into a single
container, which can be run on any system that supports docker. This
simplifies deployment and eliminate dependency conflicts.
2. Environment Isolation:
Each containers is isolated, providing a consistent environment for
applications regardless of the underlying host system. This helps with
environment replication across development, stagging and production.
3. CI/CD pipelines: (Continuous Integration and Continuous Delivery/Development) Docker
containers are widely used in CI/CD pipelines to ensure consistent
testing, building and deployment environment.
4. Scalability: Dockers containers can be easily scaled up or down in a Kubernetes or docker
swarm environment.
Core components of Docker
It is responsible for the overall functioning of the
docker platform and docker engine is a client-server based
application and consists of 3 main components.
- Server
- REST API
- Client
- Server -> The server runs a daemon known as dockerd
(Docker Daemon), which is nothing but a process. It is responsible for
creating and managing docker images, containers, networks and volumes on the
Docker platform.
- REST API - The REST API specifies how the applications can interact with the server and instruct it
to get their job done.
- The client is nothing but a command line
interface, that allows users to interact with docker using the commands.
Docker Terminology
Docker Images and Docker containers are the two essential things that
you will come across daily while working with docker.
In simple
terms, a docker image is a template that contains the application, and all the
dependencies required to run that application on docker.
On the
other hand, as started earlier, a docker container is a logical entity. In
more precise terms, it is a running instance of the docker image.
What is Docker Hub?
Docker hub is the official online repository where you could find all
the docker images that are available for us to use also allows us to store and
distribute our custom images as well if we wish to do so. We could also make
them either public or private, based on our requirements.
What
is Docker image?
Docker image is actually an executable file that
file inside instruction for which types of container we should make so using
one image we can create multiple container.
Image is basically like
a static screenshot or static snapshot of what the code and the dependencies
or what the local development environment look like.
The relation
between Docker and Container like the same as Class (class - how look like
object create a blueprint of code) and Object in between of relation.
Docker
image is giving a blue print of how container look like in MAC, Linux,
Windows.
Container
Docker is platform or services that useful for creating a container.
container i
- Portable - Portable means we can share data one machine to another machine is become to easier share code as well as dependencies with their development team.
- Lightweight - Lightweight means easier to build, update and destroy and if we want install extra addon dependencies then we can install in same container.
OR
why we make container so what should i do for making container ?
- Containers are standardized software units that package code and dependencies together, ensuring an application runs quickly and reliably across any computing environment.
after making Docker Container and add some dependencies or else so we should make again docker image ?
Yes, you need to create a new image if you want to save those
changes permanently. Containers are temporary and disposable. Any changes you
make directly inside a running container will be lost forever if that
container is stopped, deleted, or restarted.
You have two
main ways to handle this, depending on your goal:
Method: Save the Live Container (Quick Fix)
If you spent a lot of time configuring a running container
manually and do not want to lose your work immediately, you can take a
snapshot of it.
Find your running container ID:
- bashdocker ps
Use code with caution.Commit the changes to create a brand new image
directly from that running container:
- bashdocker commit CONTAINER_ID your-new-image-name
How to install and run docker desktop
Step 1: Check Requirements
Option A: Docker Desktop
(Recommended)
Requirements:
- Windows 10 64-bit
- At least 4 GB RAM (8+ GB recommended)
- Hardware virtualization enabled in BIOS
- WSL 2 support
First, open PowerShell as Administrator and check:
systeminfo
Look for:
- Hyper-V Requirements: Yes
- Virtualization Enabled In Firmware: Yes
Step 2: Enable WSL 2
Open PowerShell as
Administrator:
wsl --install
After completing task 1 like according to image 1(above image) it will ask for reboot the system then after rebooting the system (according to image 2 - below) it will automatically popup a cmd and run this wsl linux.
Restart your PC.
Verify:
wsl --status
You should see WSL version 2 installed.
Step 3: Download Docker Desktop
Go to:
Docker Desktop for Windows
Download the installer.
Step 4: Install Docker Desktop
Run the installer.
During installation:
✅
Use WSL 2 instead of Hyper-V (recommended)
✅ Add Docker Desktop
shortcut
Restart if prompted.
Step 5: Start Docker
Launch Docker Desktop.
Wait until Docker
reports:
- Docker Engine running
Step 6: Verify Installation
Open PowerShell:
- docker --version
Example output:
- Docker version 28.x.x
Check Docker engine:
- docker info
NOTE - some useful URLs you can check here
- https://hub.docker.com/_/hello-world
- https://app.docker.com/accounts/whoiskumaratul
Step 7: Run Your First Container
To run this your first container hello world docker from URL - you can check
here -
Docker Hello World
Test Docker with:
- docker run hello-world
If successful, you'll see a welcome message.
So, for this we will pull first - docker pull hello-world
Then run container and you can see in the docker desktop UI there will be create docker image and docker container
- docker run hello-world
Docker Ubuntu
When we installed wsl ubuntu you have noticed in your local directory - linux section is there
you can run this via Linux ubuntu - try this command docker run -it ubuntu
-it -> we want to run in interactive mode
Now we can check directory and create new folder, file because we are in linux directory
Stop container
- docker stop <container_id>
Remove container
- docker rm <container_id>
Remove image
- docker rmi <image_name>
Step 8: Run an Nginx Web Server
Pull and run Nginx:
- docker run -d -p 8080:80 nginx
Verify:
- docker ps
Open browser:
- http://localhost:8080
You should see the Nginx welcome page.
Essential Docker Commands for Interviews
List running containers
- docker ps
List all containers
- docker ps -a
List images
- docker images
Stop container
- docker stop <container_id>
Remove container
- docker rm <container_id>
Remove image
- docker rmi <image_name>



















































