## Importance of Docker
- Containers are essential for creating reproducible, lightweight environments.
- Commonly used in CI/CD (e.g., GitHub Actions) and cloud deployments.
## Virtualization vs. Containerization
### Virtualization
- Involves creating Virtual Machines (VMs) that run full operating systems.
- Managed by a hypervisor (e.g., VMware, VirtualBox).
- VMs share hardware resources (CPU, memory, disk).
### Containerization
- Enables processes to run in isolation on a shared OS kernel. - Uses techniques like `chroot` for process isolation.
- Docker simplifies management of containers.
## Docker Concepts
- **Docker Images**: Blueprint for containers; can be pulled from Docker Hub.
- **Docker Containers**: Running instances of Docker images.
- **Dockerfile**: Instructions for building Docker images.
### Example Dockerfile Structure
- Uses `FROM` to specify base image (e.g., Ubuntu).
- `RUN` command installs dependencies.
- `COPY` transfers files into the image.
- `CMD` specifies the default command to run in the container.
## Building and Running Docker Images
1. **Build Image**: `docker build -t <image_name> .`
2. **Run Container**: `docker run <image_name>`
## Key Takeaways
- Images are immutable; to make changes, create a new image.
- Docker facilitates easy deployment and management of applications.