Install Docker Linux

To install Docker on Linux, you can follow these general steps:


1. Update your system: Open a terminal and run the following commands to ensure your system is up to date:


   sudo apt update

   sudo apt upgrade



2. Install dependencies: Docker requires some dependencies to be installed. Run the following command to install them:


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



3. Add the Docker repository key: Use the following command to add Docker's official GPG key:


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



4. Add the Docker repository: Based on your Linux distribution, choose the appropriate command below:


   For Ubuntu:


   echo "deb [arch=amd64 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



   For Debian:


   echo "deb [arch=amd64 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



5. Install Docker: Update the package index and install Docker by running the following commands:


   sudo apt update

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



6. Verify the installation: After the installation is complete, you can check if Docker is working correctly by running the following command:


   sudo docker run hello-world



   This command will download a test Docker image and run it in a container. If everything is set up properly, you will see a "Hello from Docker!" message.


That's it! Docker should now be installed on your Linux system. Remember, some Linux distributions may have slightly different package managers or package names, so adjust the commands accordingly if needed.