Installation guides

Installing Docker on Debian

Step-by-Step Guide

  1. Update the Package Index
    Open a terminal and update the package index to ensure you have the latest information about available packages:
   sudo apt update
  1. Install Necessary Packages
    Install the necessary packages for Docker:
   sudo apt install apt-transport-https ca-certificates curl software-properties-common
  1. Add Docker’s Official GPG Key
    Add Docker’s official GPG key to your system:
   curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  1. Set Up the Docker Repository
    Add the Docker APT repository to your system:
   echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  1. Update the Package Index Again
    Update the package index again to include the Docker repository:
   sudo apt update
  1. Install Docker
    Install Docker using the apt package manager:
   sudo apt install docker-ce docker-ce-cli containerd.io
  1. Verify Docker Installation
    Check the Docker version to ensure it is installed correctly:
   docker --version

You should see the Docker version information displayed.

  1. Start and Enable Docker
    Ensure Docker starts on boot:
   sudo systemctl start docker
   sudo systemctl enable docker
  1. Add Your User to the Docker Group (Optional)
    To run Docker commands without sudo, add your user to the Docker group:
   sudo usermod -aG docker $USER

Log out and log back in for the changes to take effect, or use the following command to apply the changes immediately:

   newgrp docker
  1. Test Docker Installation
    To test Docker, run the hello-world container: docker run hello-world If Docker is installed correctly, you should see a message saying “Hello from Docker!”
  2. Install Docker Compose (Optional)
    Docker Compose is a tool for defining and running multi-container Docker applications. To install Docker Compose, download the binary:
    bash 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
    Apply executable permissions to the binary:
    bash sudo chmod +x /usr/local/bin/docker-compose
    Verify the installation:
    bash docker-compose --version
Other Recent Posts