일. 8μ›” 3rd, 2025

—.

πŸ” What is Docker?

It’s a container-based virtualization platform that provides a “build once, run anywhere” environment.
βœ… Runs faster and is lighter than traditional virtualization (VMs) Simplifies application deployment and management Ensures consistency across dev/test/production environments

—.

βš™οΈ Preparation before installation

  1. Check Ubuntu version (20.04 LTS or higher recommended)
    
    lsb_release -a
    ```bash lsb_release -a
    ![Example output](https://via.placeholder.com/400x50?text=Distributor+ID%3A+Ubuntu+%0ARelease%3A+22.04)
  2. **Update the repository
    
    sudo apt update && sudo apt upgrade -y
    ```bash

—]

πŸš€ Step-by-step guide to installing Docker

1️⃣ Uninstall the previous Docker (optional)

sudo apt remove docker docker-engine docker.io containerd runc

2️⃣ Install prerequisite packages

sudo apt install -y ca-certificates curl gnupg lsb-release

3️⃣ Add the Docker official GPG key πŸ”‘

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

4️⃣ Set up a repository πŸ“¦

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

5️⃣ Install the Docker engine

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

6️⃣ Verify the installation πŸŽ‰ .

sudo docker run hello-world

βœ… Print on success

Hello from Docker!  
This message shows your installation appears to be working correctly.

—]

⚑ Set user permissions (prevent sudo every time)

sudo usermod -aG docker $USER # add current user docker group
newgrp docker # Apply group settings immediately

✏️ Apply without reboot: `newgrp docker or rerun terminal

—]

πŸ› οΈ Additional useful settings

πŸ”„ Enable Docker autostart

sudo systemctl enable docker.service
sudo systemctl enable containerd.service
```bash

#### πŸ”„ Control the Docker service
```bash
sudo systemctl start docker # Start
sudo systemctl stop docker # Stop
sudo systemctl restart docker # restart
```bash

#### ℹ️ Check the version
```bash
docker --version # Docker version
docker compose version # Compose plugin version

—]

πŸ§ͺ Test the installation: Run the Nginx container

docker run -d -p 8080:80 --name my-nginx nginx
  1. access http://localhost:8080 in your browser
  2. see “Welcome to nginx!” 3. stop and delete the container
  3. stop and delete the container:
    docker stop my-nginx && docker rm my-nginx

—]

❌ Troubleshooting tips.

  • “Permission denied”** error:
    sudo chmod 666 /var/run/docker.sock # Temporary workaround (security alert!)

    β†’ Permanent workaround: re-login user or run newgrp docker

  • GPG key error: re-run sudo apt update after adding repository

—]

βœ… Closing checklist.

  • [ ] Successfully run hello-world container
  • [ ] User permission groups added successfully
  • [ ] Nginx test container working properly
  • [ ] Docker service auto-start enabled

> πŸ“’ **Feel the power of Docker! > Set up development environment in 5 minutes ➜ Deploy production in 1 second 😎 > bash > # Example: Running a MySQL container. > docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw --name my-db mysql:8.0 >

Your container journey has begun 🚒. Build an efficient development environment with Ubuntu + Docker combination!

λ‹΅κΈ€ 남기기

이메일 μ£Όμ†ŒλŠ” κ³΅κ°œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•„μˆ˜ ν•„λ“œλŠ” *둜 ν‘œμ‹œλ©λ‹ˆλ‹€