Skip to content
Go back

Getting Started with Docker – Containers, Images & the Basics

Edit page

🎯 Whether you’re just exploring containers or preparing for real-world DevOps, this guide will set the stage.


Docker

Table of Contents

Open Table of Contents

🔧 Installation

Before we begin, install Docker on your system:

👉 Click here to visit the official Docker installation page


🐳 What is Docker? Why Use It?

Docker is an open-source platform that allows you to package, distribute, and run applications in isolated environments called containers.

It provides a standardized way to ensure software runs consistently across different environments. Everything runs in a lightweight, portable package — making development, testing, and deployment faster and more reliable.


🧱 Containers vs Virtual Machines

FeatureContainersVirtual Machines
IsolationProcess-levelFull OS-level
SpeedLightweight and fastHeavy and slow startup
SizeSmall (MBs)Large (GBs)
Use CasesMicroservices, CI/CD, App packagingFull OS testing, legacy apps

🧠 Docker Architecture

Docker is made up of the following components:


🛠️ Key Docker Components

🔹 Images

🔹 Containers

🔹 Volumes

🔹 Networks


🧾 What is a Dockerfile?

A Dockerfile is a text-based script of instructions for building a Docker image.

Example:

FROM python:3.11
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ["python", "app.py"]

⚙️ Useful Docker Commands & Flags

🔍 Check Version & System Info

docker --version
docker info

📥 Pulling an Image

docker pull alpine

Downloads the Alpine base image.


🚀 Running a Container

Interactive shell inside Alpine:

docker run -it alpine sh

Running an nginx container on port 8080:

docker run -d -p 8080:80 --name web nginx

Common flags:


📋 Managing Containers

List containers:

docker ps        # Running only
docker ps -a     # All, including stopped

Stop, start, remove containers:

docker stop mycontainer
docker start mycontainer
docker rm mycontainer

📦 Working with Images

List all images:

docker images

Remove an image:

docker rmi nginx

🧭 What’s Next?

In the next part, we’ll explore how to build your own Docker images using Dockerfiles, manage image layers efficiently, and follow best practices for optimized builds.

Stay tuned for Part 2: Building Docker Images Like a Pro.


🧠 Extra Learning: Read official Docker docs for deeper reference.


Edit page
Share this post on:

Next Post
Will AI Replace Humans in Pentesting?