Docker has become an essential tool for developers, system administrators, and DevOps engineers. It allows you to run applications in lightweight containers, making deployments faster, more consistent, and easier to manage.

In this guide, you’ll learn how to install Docker on an Ubuntu server and get started with your first container.

🧠 What is Docker?

Docker is a containerization platform that enables you to package applications along with their dependencies into portable containers. These containers can run consistently across different environments.

🔧 Step 1: Update Your System

Before installing Docker, update your system packages:

sudo apt update && sudo apt upgrade -y

🔧 Step 2: Install Required Dependencies

Install packages required to use HTTPS repositories:

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

🔐 Step 3: Add Docker’s Official GPG Key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor

📦 Step 4: Add Docker Repository

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

⚙️ Step 5: Install Docker Engine

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y

✅ Step 6: Verify Docker Installation

Run the following command to test Docker:

sudo docker run hello-world

If Docker is installed correctly, you’ll see a confirmation message.

🔓 Step 7: Run Docker Without sudo (Optional)

To run Docker commands without using sudo, add your user to the Docker group:

sudo usermod -aG docker $USER

Then log out and log back in for the changes to take effect.

🧩 Step 8: Install Docker Compose

Docker Compose allows you to define and manage multi-container applications.

sudo apt install docker-compose -y

🌐 Step 9: Run Your First Container

Example: Run Nginx Web Server

docker run -d -p 8080:80 nginx

Now open your browser and visit:

http://<your-server-ip>:8080

You should see the Nginx welcome page.

🧪 Example: Run a Test Container

docker run hello-world

🔐 Basic Security Tips

This verifies that Docker is working correctly.

  • Avoid exposing Docker services directly to the internet without proper security controls
  • Keep your system updated regularly
  • Use official images from trusted sources
  • Limit container privileges when possible

💡 Useful Docker Commands

CommandDescription
docker psList running containers
docker ps -aList all containers
docker imagesList images
docker stop <id>Stop container
docker rm <id>Remove container

🎯 Conclusion

Docker simplifies application deployment by packaging everything into containers. With just a few commands, you can install Docker, run applications, and manage services efficiently.

Whether you’re a developer, system administrator, or learner, Docker is a powerful tool worth mastering.

Leave a comment

Hey there, fellow nerds and net-surfers!

Welcome to my corner of the internet where I talk about the holy trinity of tech: NetworkingLinux, and Security — or as I like to call it, “Ctrl+Alt+Fix-It”. If you’re into packet sniffing (the legal kind), hardening Linux boxes, or figuring out why your network is being as moody as a teenager, you’re in the right place.

This blog is where I dump useful knowledge, random tech rants, and occasional troubleshooting victories so future me (and hopefully you) can benefit. Expect bash scripts, firewall rules, sarcastic comments, and the occasional meme — because what’s IT without a little command-line chaos and caffeine?

Whether you’re a curious beginner or a battle-hardened sysadmin, I hope you’ll find something here to learn, laugh at, or copy-paste in desperation.

Welcome aboard — and may your logs always be verbose.

Let’s connect