This experiment demonstrates the practical implementation of containerization using Docker. The goal is to understand how Docker images are pulled, containers are deployed, services are exposed using port mapping, and how the complete container lifecycle is managed.
Containers provide lightweight, fast, and portable environments compared to traditional virtual machines. This lab focuses on real-world Docker CLI operations used in DevOps and Cloud environments.
| Component | Details | |———–|———| | OS | Windows / Linux / macOS | | Software | Docker Desktop | | Network | Active Internet connection | | Interface | Terminal / PowerShell |
| Concept | Explanation | |———|————-| | Image | Read-only template used to create containers | | Container | Running instance of an image | | Port Mapping | Connects host port to container port | | Detached Mode | Runs container in background | | Docker Hub | Public image repository |
docker pull nginx
Downloads the official nginx web server image.
docker run -d -p 8080:80 nginx
| Option | Meaning | |——–|———| | -d | Detached mode | | -p 8080:80 | Maps host port 8080 → container port 80 | | nginx | Image name |
Now open: http://localhost:8080
docker ps
Displays container ID, image, status, and port mappings.
docker stop <container_id>
docker rm <container_id>
docker rmi nginx
The nginx image was pulled, container deployed, verified, stopped, removed, and the image deleted successfully.
Docker simplifies application deployment using containers. Compared to VMs, containers start faster, consume fewer resources, and are ideal for cloud-native microservices.