Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Docker»How to Install Docker on CentOS/RHEL 8

    How to Install Docker on CentOS/RHEL 8

    By RahulApril 11, 20203 Mins ReadUpdated:June 21, 2020

    Docker is an OS level virtualization platform used for container-based application. Which wrap of a specific application with all its dependencies in a container. Docker containers can easily ship to a remote location on start there without making entire application setup. This tutorial will help you to install and manage Docker community edition on CentOS/RHEL 8 Linux system.

    Advertisement

    Step 1 – Enable Docker Repository

    First of all, add the official Docker yum repository on your CentOS 8 system.

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

    Step 2 – Install Docker on CentOS 8

    After adding the yum repository to your CentOS system, update the yum cache by executing the following command.

    sudo dnf makecache
    

    Now install docker community edition package to install docker on your system. This is installed many of the required decencies on your system.

    sudo dnf install --nobest docker-ce
    

    The –nobest option instruct installer to not to limit for best candidate package dependency.

    Step 3 – Manage Docker Service

    Once the Docker successfully installed on your CentOS 8 system. Use the following commands to enable Docker serivce and start it.

    sudo systemctl enable docker.service
    sudo systemctl start docker.service
    

    Then check the Docker service status.

    sudo systemctl status docker.service
    

    Result

    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
       Active: active (running) since Fri 2020-04-10 05:26:46 UTC; 1s ago
         Docs: https://docs.docker.com
     Main PID: 23263 (dockerd)
        Tasks: 18
       Memory: 50.0M
       CGroup: /system.slice/docker.service
               ├─23263 /usr/bin/dockerd -H fd://
               └─23275 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
    
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.439527082Z" level=info msg="Graph migration to >
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.440174585Z" level=warning msg="Your kernel does>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.440197735Z" level=warning msg="Your kernel does>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.440723426Z" level=info msg="Loading containers:>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.677587189Z" level=info msg="Default bridge (doc>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.801904550Z" level=info msg="Loading containers:>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.861334755Z" level=info msg="Docker daemon" comm>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.864579987Z" level=info msg="Daemon has complete>
    Apr 10 05:26:46 tecadmin dockerd[23263]: time="2020-04-10T05:26:46.881460358Z" level=info msg="API listen on /var/>
    Apr 10 05:26:46 tecadmin systemd[1]: Started Docker Application Container Engine.
    

    Docker has been installed and running on your CentOS 8 operating system. You can visit our Docker tutorial section to work with Docker containers.

    Step 4 – Test Docker on CentOS 8

    Search Docker Images

    First of all search Docker container images from Docker hub. For example, below command will search all images with Ubuntu and list as output

    sudo docker search hello-world
    

    Download Docker Images

    Now download the Docker container with name Ubuntu on your local system using following commands.

    sudo docker pull hello-world
    

    Output:

    Using default tag: latest
    latest: Pulling from library/hello-world
    1b930d010525: Pull complete
    Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
    Status: Downloaded newer image for hello-world:latest
    docker.io/library/hello-world:latest
    

    Now make sure that above images have been downloaded successfully on your system. Below command list all images.

    sudo docker images
    

    Output:

    REPOSITORY          TAG          IMAGE ID          CREATED             SIZE
    centos              latest       470671670cac      2 months ago        237MB
    hello-world         latest       fce289e99eb9      15 months ago       1.84kB
    

    Run Hello-World Docker Container

    Use the following command to run a hello-world docker container. This container will print a message on screen and exit immediately.

    docker run -i hello-world
    

    You will see the results like below screenshot. The success message shows that Docker service is properly installed on your CentOS 8 system.

    Install Docker CentOS 8

    CentOS 8 Docker Docker install
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Running a Cronjob Inside Docker: A Beginner’s Guide

    Running a Cronjob Inside Docker: A Beginner’s Guide

    Docker Run: A Beginner’s Guide to Run Docker Containers

    Docker Run: A Beginner’s Guide to Run Docker Containers

    Docker Build: A Beginner’s Guide to Building Docker Images

    Docker Build: A Beginner’s Guide to Building Docker Images

    View 3 Comments

    3 Comments

    1. vinsent paramanantham on September 6, 2021 5:29 am

      This was a really a time saver. I was roaming for more the 30mins.. you made it simple, Good to have you in the tech community. Thanking you.

      Reply
    2. Ibrahim Elamin on June 2, 2021 4:33 am

      HI Rahul,

      Thanks for the great post. I am getting an error when running the=e following command:

      [[email protected] ~]$ sudo dnf install –nobest docker-ce

      created by dnf config-manager from https://downlo 1.3 kB/s | 367 B 00:00
      Errors during downloading metadata for repository ‘download.docker.com_linux_centos_’:
      – Status code: 404 for https://download.docker.com/linux/centos/repodata/repomd.xml (IP: 99.86.61.58)
      Error: Failed to download metadata for repo ‘download.docker.com_linux_centos_’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

      Your advice is appreciated..

      Regards,

      Reply
    3. Howard on January 8, 2021 1:50 am

      This blog post should be at the top of the Google search. I spent the entire day today trying to install Docker on RHEL 8. Apparently from what I read, RedHat doesn’t like Docker because it wants its users to lock-in to their platform?

      I wasted so much time trying to get it to install Docker today. Through other guides, I was able to install Docker, but the installation was faulty, as Docker processes wouldn’t run. (RHEL 8.3, Docker 20.10.2) This guide finally helped me install Docker.

      THANK YOU, Rahul, for the informative post!

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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