Roll No:160122733163 Week-6 Date:10/10/2025
Exp-6
Aim:
To understand Docker Architecture and Container Life Cycle, install Docker and execute
docker commands to manage images and interact with containers.
Description:
Docker is an open-source containerization platform that allows developers to package
applications with all dependencies into containers.
These containers can run consistently across different environments (development, testing,
and production) without configuration issues.
What is Docker?
Docker is a platform for building, shipping, and running applications inside lightweight,
portable [Link] simplifies the deployment process by ensuring that the software runs
the same, regardless of where it’s deployed.
Example:
If a web app runs on your system but fails on your friend’s laptop because of missing
dependencies, Docker solves this problem by packaging everything needed inside a
container.
Docker Architecture:
Docker uses a client-server architecture consisting of the following components:
1. Docker Client:
o The user interacts with Docker using commands like docker run, docker build,
[Link] client communicates with the Docker Daemon via REST APIs.
2. Docker Daemon (dockerd):
o Runs in the background and manages Docker objects such as images,
containers, networks, and volumes.
3. Docker Images:
o Read-only templates used to create containers. Example: ubuntu, python,
nginx.
4. Docker Containers:
o Running instances of Docker images. Each container is isolated and portable.
5. Docker Hub:
o A cloud-based registry where Docker images are stored and shared publicly or
privately.
Fig1:Docker Architecture
Page No. Signature of the Faculty………………………...
Roll No:160122733163 Week-6 Date:10/10/2025
What is a Container?
A container is a lightweight, standalone, and executable unit that includes the application
code, runtime, system tools, libraries, and configurations required to run the application.
It behaves like a virtual machine but shares the host system’s kernel, making it more efficient
and faster.
Container Life Cycle in Docker:
1. Create – The container is created from an image but not yet running.
Command: docker create <image_name>
2. Start – The container starts executing.
Command: docker start <container_id>
3. Run – Combines create and start in a single step.
Command: docker run <image_name>
4. Pause/Unpause – Temporarily halts or resumes processes inside a container.
Command: docker pause <container_id> / docker unpause <container_id>
5. Stop – Gracefully stops the running container.
Command: docker stop <container_id>
6. Kill – Immediately terminates a container.
Command: docker kill <container_id>
7. Remove – Deletes the stopped container from the system.
Command: docker rm <container_id>
Fig2 : Container Lifecycle in Docker
Installation of Docker:
1. Enable Virtualization:
• Press Ctrl + Shift + Esc → Go to “Performance” tab → CPU → Look for
“Virtualization: Enabled”
• If it says “Disabled,” reboot your PC.
• Enter BIOS/UEFI by pressing F2, Delete, or Esc during boot (varies by
brand).
• Find Virtualization Technology (VT-x / SVM) and enable it.
• Save and exit BIOS.
2. Download Docker Desktop
• Go to the official Docker website:
[Link]
• Click “Download for Windows (x86_64)”.
• Once downloaded, open the Docker Desktop [Link] file.
3. Install Docker Desktop
Page No. Signature of the Faculty………………………...
Roll No:160122733163 Week-6 Date:10/10/2025
• Run the installer as Administrator.
• When prompted:
• Keep “Use WSL 2 instead of Hyper-V” checked.
• Ensure “Add shortcut to desktop” is selected.
• Click OK → Install.
• Wait for the installation to complete, then click Close and restart if prompted.
4. Set up WSL 2 (Windows Subsystem for Linux)
• Docker Desktop uses WSL 2 as its backend.
• If WSL 2 is not installed:
• Open PowerShell as Administrator.
• Run: wsl --install
• Restart your computer.
• Once restarted, open Docker Desktop → it will automatically detect WSL 2.
5. Launch Docker Desktop
• Open Docker Desktop from the Start Menu or Desktop icon.
• Wait for the Docker whale icon to appear in the system tray (bottom-right
corner).
• When it says “Docker Desktop is running”, you’re ready!
6. Verify Installation
• Open Command Prompt (cmd) or PowerShell, and run:
• docker –version
Basic Docker Commands:
[Link] –version
2. docker pull ubuntu
Downloads the Ubuntu image from Docker Hub.
3. docker images
Page No. Signature of the Faculty………………………...
Roll No:160122733163 Week-6 Date:10/10/2025
Lists all available images on the system.
4. docker run -it ubuntu
Creates and starts an interactive Ubuntu container.
[Link] images
[Link] ps -a
Lists all containers (running + stopped).
[Link] stop <container_id>
Stops a running container.
[Link] rm <container_id>
[Link] rmi <image_id>
Deletes an image from the local system.
10. docker exec -it <container_id> bash
Opens a terminal inside a running container.
11. exit
Exits from the running container terminal.
Conclusion:
The experiment demonstrates the working of Docker architecture and the container life cycle.
It helps in understanding how Docker uses images, containers, and the Docker daemon to
manage applications [Link] executing basic Docker commands, the process of creating,
running, and managing containers becomes [Link] enhances the understanding of
containerization and its role in ensuring consistent and isolated application environments.
Page No. Signature of the Faculty………………………...