Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Docker Tutorials»How to Install Docker on CentOS Stream 9 & RHEL 9

    How to Install Docker on CentOS Stream 9 & RHEL 9

    By RahulApril 30, 20233 Mins Read

    Docker is an open-source platform that automates the deployment, scaling, and management of applications in containers. Containers allow developers to package an application with all its dependencies and deliver it as a single package, which can be deployed on any system that supports containerization. In this tutorial, we will guide you through the process of installing Docker on CentOS Stream 9 and RHEL 9.

    Advertisement

    Prerequisites

    • A freshly installed CentOS Stream 9 or RHEL 9 system.
    • A user account with sudo privileges.

    Step 1: Update the System

    Before installing Docker, it is essential to update your system to ensure all the required packages and dependencies are up-to-date. Execute the following command:

    sudo dnf update -y
    

    Step 2: Install Required Dependencies

    Next, install the necessary dependencies for Docker:

    sudo dnf install -y yum-utils device-mapper-persistent-data lvm2
    

    Step 3: Add Docker Repository

    Now, add the Docker repository to your system. The configuration file is avaialble on Docker’s official site. The CentOS Stream 9 users execute the following command:

    sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    For RHEL 9 users, the command will be:

    sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
    

    Step 4: Install Docker CE

    With the Docker repository in place, you can now install Docker CE (Community Edition) using the following command:

    sudo dnf install -y docker-ce --nobest
    

    The --nobest flag is used to install the highest version of Docker that satisfies the package’s dependencies.

    Step 5: Enable and Start Docker Service

    Once the installation is complete, enable the Docker service to start on boot and start the service immediately:

    sudo systemctl enable --now docker
    

    Step 6: Verify Docker Installation

    To ensure that Docker is installed and running correctly, you can check its status with the following command:

    sudo systemctl status docker
    

    Additionally, you can verify the installed version by running:

    sudo docker --version
    

    Step 7: Configure Docker to Run Without Sudo (Optional)

    By default, Docker requires sudo privileges to execute commands. If you want to run Docker commands without sudo, you can add your user to the “docker” group. Replace “your_username” with your actual username:

    sudo usermod -aG docker your_username
    

    Log out and log back in for the changes to take effect. Keep in mind that adding your user to the “docker” group gives the user root-level privileges. Make sure you understand the security implications before performing this step.

    Conclusion

    You have now successfully installed Docker on your CentOS Stream 9 or RHEL 9 system. You can start deploying and managing containerized applications using the Docker platform. To learn more about Docker and its usage, consult the official Docker documentation at https://docs.docker.com/.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Deploy PHP, Apache, and MySQL with Docker Compose

    Setting Up Environment Variables in Docker: A Comprehensive Guide

    How to Check if a Docker Image Exists Locally

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Setting Up Angular on Ubuntu: Step-by-Step Guide
    • Converting UTC Date and Time to Local Time in Linux
    • Git Restore: Functionality and Practical Examples
    • Git Switch: Functionality and Practical Examples
    • Git Switch vs. Checkout: A Detailed Comparison with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.