Skip to content

Latest commit

 

History

History
75 lines (56 loc) · 2.35 KB

docker-ubuntu.md

File metadata and controls

75 lines (56 loc) · 2.35 KB

Absolutely! Here's a Markdown file detailing the installation of Docker on an Ubuntu server:

Docker Installation on Ubuntu

This guide provides step-by-step instructions on how to install Docker Engine on your Ubuntu server.

Prerequisites

  • An Ubuntu system (e.g., 20.04, 22.04)
  • Sudo privileges

Steps

  1. Update Package Lists:

    sudo apt update
  2. Install Dependencies:

    sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
  3. Add Docker's GPG Key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Add Docker Repository:

    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
  5. Update Package Lists Again:

    sudo apt update
  6. Install Docker Engine:

    sudo apt install -y docker-ce docker-ce-cli containerd.io
  7. Verify Installation:

    sudo docker run hello-world

    You should see a "Hello from Docker!" message indicating a successful installation.

Post-Installation (Optional)

  • Manage Docker as a Non-Root User:

    sudo groupadd docker
    sudo usermod -aG docker $USER
    newgrp docker 

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

  • Configure Docker Daemon (optional): Create or edit /etc/docker/daemon.json for custom settings like proxy, storage driver, etc.

  • Install Docker Compose (optional): For managing multi-container Docker applications:

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

Additional Notes

  • Older Docker Versions: You can search the Docker repository for specific versions if needed.
  • Firewall: If you're using a firewall, ensure the necessary ports are open.
  • Official Documentation: For the most comprehensive instructions, refer to the official Docker documentation: https://docs.docker.com/engine/install/ubuntu/