π³ Docker Fundamentals

βοΈ How Containers Work
Containers do not consume pre-allocated resources like virtual machines.
They use shared system resources (CPU, RAM, storage).
If a container needs only 200MB of space, it will consume only 200MB, not more.
π‘ Containerization is made possible through Docker.
π§ Hypervisor vs Docker
Hypervisor: Used in virtual machines (e.g., VirtualBox, VMware). It allocates separate OS and resources to each VM.
Docker: Uses shared OS kernel (specifically Linux kernel) to run containers more efficiently with fewer resources.
π§ Installing Docker (on Ubuntu)
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker
π Installing Docker (on macOS)
brew install --cask docker
docker --version
π How Docker Works
Docker consists of the following components:
Docker CLI β Command Line Interface
Docker Daemon (dockerd) β Runs in the background and manages containers/images
Containers β Lightweight isolated environments to run apps
Docker Images β Blueprints used to create containers
Flow:
DOCKER CLI β Docker Daemon β Container
π§ͺ Common Docker Commands
docker ps β Lists running containers
cat /etc/group β Checks if youβre in the docker group
If not in the group:
sudo usermod -aG docker $USER
newgrp docker # Refresh group membership
π§ $USER is an environment variable representing the currently logged-in user.
π Docker File β Image β Container
A Dockerfile is used to create a Docker image.
An image is like a blueprint.
A container is a running instance of that image.
Without a Dockerfile, you can directly pull and run prebuilt images using DockerHub.
π οΈ Example Docker Run Commands
docker run -it ubuntu ,,,, Interactive terminal
docker run -itd ubuntu ,,,, Interactive + detached (runs in background)
docker run -d -p 80:80 nginx ,,,,, Run nginx in background and expose port 80
docker run -it -d -p 80:80 nginx β¦β¦.Interactive + detached nginx
β Stopping a Container
docker stop <container_id>
Subscribe to my newsletter
Read articles from AWSomeVikash directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

AWSomeVikash
AWSomeVikash
π Hi, I'm Vikash Patel β a passionate AWS & DevOps enthusiast, sharing my complete learning journey and real-world implementations. π On this blog, Iβm publishing a full DevOps + AWS roadmap β from basics to advanced, covering: π‘ AWS Services: EC2, S3, IAM, CloudWatch, Billing, and more π§ Linux commands & scripting βοΈ CI/CD pipelines with GitHub Actions & Jenkins π§± Infrastructure as Code using Terraform π Monitoring, Alerts & Troubleshooting π‘ Every post is beginner-friendly β focused on clarity, practical use-cases, and hands-on solutions. π Iβm also building my presence in the AWS Community, sharing what I learn, and learning from others. π± Whether you're starting your cloud journey or looking for practical DevOps solutions, this blog is for you.