Skip to content

Instantly share code, notes, and snippets.

@mkrdip
Created August 22, 2024 21:41
Show Gist options
  • Save mkrdip/fc5f168e76b7a256ba3bb5145cabd23b to your computer and use it in GitHub Desktop.
Save mkrdip/fc5f168e76b7a256ba3bb5145cabd23b to your computer and use it in GitHub Desktop.
A fast and straightforward guide to installing Docker on RHEL, complete with Docker Compose and Buildx plugin setup. Perfect for developers and sysadmins.

Docker Installation on RHEL

This guide provides steps to install Docker on a RHEL (Red Hat Enterprise Linux) system.

Prerequisites

Ensure that you have sudo privileges on the RHEL system.

Steps

  1. Install yum-utils

    yum-utils is a collection of utilities and plugins that extend and enhance the functionalities of yum.

    sudo yum install -y yum-utils
    • -y flag: Automatically answers "yes" to all prompts during the installation, allowing yum to proceed without user interaction.
  2. Add Docker's Official Repository

    Use the yum-config-manager utility to add Docker's official repository to your system.

    sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
  3. Install Docker and its Components

    Install Docker Community Edition along with essential tools. This includes Docker Compose, which is required for defining and running multi-container Docker applications. The --allowerasing flag allows yum to resolve any package conflicts by removing incompatible packages if necessary.

    sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin --allowerasing
  4. Enable Docker to Start on Boot

    Ensure that Docker starts automatically whenever the system boots up.

    sudo systemctl enable docker
  5. Reboot the System

    Reboot your system to apply all changes and start Docker.

    sudo reboot

Post-Installation

After the system reboots, Docker will start automatically. You can verify that Docker is running by checking its status:

sudo systemctl status docker

or

sudo docker ps

Getting Started

Get started with Docker by running the hello-world container to verify the installation:

sudo docker run hello-world

Troubleshooting

If you encounter any issues, you can check Docker's logs using:

sudo journalctl -u docker

Additional Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment