DEV Community

Bhaskar Sharma
Bhaskar Sharma

Posted on

πŸš€ Day 7 of My DevOps Journey: Docker Basics

Hello dev.to community! πŸ‘‹

Yesterday, I explored Linux Services & Systemd β€” the backbone of process management. Today, I’m diving into Docker β€” the magic behind modern containerization. 🐳

πŸ”Ή Why Docker matters for DevOps

Consistent environments: β€œWorks on my machine” β†’ no more!

Lightweight containers replace heavy VMs.

Standard for running apps in CI/CD pipelines.

Foundation for Kubernetes & cloud-native systems.

🧠 Core concepts I’m learning

βš™οΈ What is Docker?

A containerization platform that packages apps + dependencies.

Containers share the host OS kernel but remain isolated.

πŸ“¦ Docker Images & Containers

Image = blueprint (e.g., nginx:latest).

Container = running instance of an image.

πŸ”§ Basic Docker commands

Run a container:

docker run -it ubuntu bash

List containers:

docker ps -a

Stop & remove container:

docker stop
docker rm

Pull an image:

docker pull nginx

Build an image:

docker build -t myapp .

πŸ—‚οΈ Volumes & Port Mapping

Volumes persist data β†’ docker run -v /data:/var/lib/mysql mysql

Ports expose services β†’ docker run -p 8080:80 nginx

πŸ› οΈ Mini use cases for DevOps

Run Jenkins, Nginx, or Redis in containers.

Test apps in isolated environments.

Package CI/CD pipelines into reusable images.

⚑ Pro tip
If a container fails:

Check logs β†’ docker logs

Inspect configuration β†’ docker inspect

Exec into container β†’ docker exec -it bash

πŸ§ͺ Hands-on mini-lab (try this!)

Run an Nginx container:

docker run -d -p 8080:80 nginx

Verify:
Open β†’ http://localhost:8080

🎯 You should see the Nginx welcome page in a container! πŸš€

🎯 Key takeaway
Docker is the backbone of DevOps β€” making apps portable, lightweight, and production-ready. Mastering Docker is the first step toward Kubernetes.

πŸ”œ Tomorrow (Day 8)
I’ll explore Docker Networking & Volumes β€” connecting containers and persisting data.

πŸ”– #Docker #Containers #DevOps #CICD #DevOpsJourney #SRE #CloudNative #Automation #OpenSource

Top comments (0)