ํ™”. 8์›” 12th, 2025

D: Setting up a development environment can be tricky, but with Docker, you can simplify dependency management and ensure consistency across different machines. ๐Ÿ› ๏ธ In this guide, we’ll walk through installing Docker Engine and Docker Compose on Ubuntu in a single, streamlined process.


๐Ÿ”ง Prerequisites

Before diving in, make sure you have:
โœ” Ubuntu (20.04 LTS or later recommended)
โœ” Terminal access (with sudo privileges)
โœ” Stable internet connection


๐Ÿง Step 1: Update & Install Dependencies

First, update your package list and install necessary tools:

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

This ensures your system is up-to-date and ready for Docker.


๐Ÿ‹ Step 2: Add Dockerโ€™s Official GPG Key & Repository

Docker provides its own repository for secure installations.

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

This adds Dockerโ€™s official package source.


โšก Step 3: Install Docker Engine

Now, install Docker:

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

Verify installation by checking Dockerโ€™s version:

docker --version
# Output: Docker version 20.10.12, build e91ed57

๐ŸŽ‰ Docker is now running!


๐Ÿงฉ Step 4: Install Docker Compose

Docker Compose helps manage multi-container apps. Install it with:

sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Check if it works:

docker-compose --version
# Output: Docker Compose version v2.3.3

๐Ÿ›  Step 5: Post-Installation Steps

1. Run Docker Without sudo (Optional)

By default, Docker requires sudo. To avoid this, add your user to the docker group:

sudo usermod -aG docker $USER
newgrp docker  # Refresh group changes

Now, test Docker without sudo:

docker run hello-world

(You should see a welcome message! ๐ŸŽŠ)

2. Enable Docker on Startup (Optional)

To start Docker automatically on boot:

sudo systemctl enable docker

๐Ÿš€ Bonus: Test with a Simple Docker Compose Example

Letโ€™s deploy an Nginx web server using docker-compose.yml:

version: '3'
services:
  web:
    image: nginx:latest
    ports:
      - "8080:80"

Run it with:

docker-compose up -d

Visit http://localhost:8080 to see Nginx running! ๐Ÿ–ฅ๏ธ


๐Ÿ”ฅ Troubleshooting Common Issues

โŒ “Permission Denied” when running Docker?
โ†’ Ensure your user is in the docker group (groups $USER).

โŒ Docker Compose not found?
โ†’ Check if /usr/local/bin is in your PATH.

โŒ Port already in use?
โ†’ Change the port mapping (e.g., "8081:80").


โœ… Conclusion

Youโ€™ve successfully installed Docker and Docker Compose on Ubuntu! ๐ŸŽ‰ Now you can:

  • ๐Ÿณ Run containers effortlessly
  • ๐Ÿงฉ Manage multi-service apps with Compose
  • ๐Ÿš€ Streamline your development workflow

๐Ÿ‘‰ Pro Tip: Explore Dockerโ€™s official docs for advanced features!

Happy Dockerizing! ๐Ÿ‹๐Ÿ’ป

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค