This guide provides steps to install Docker on a RHEL (Red Hat Enterprise Linux) system.
Ensure that you have sudo
privileges on the RHEL system.
-
Install
yum-utils
yum-utils
is a collection of utilities and plugins that extend and enhance the functionalities ofyum
.sudo yum install -y yum-utils
-y
flag: Automatically answers "yes" to all prompts during the installation, allowingyum
to proceed without user interaction.
-
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
-
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
-
Enable Docker to Start on Boot
Ensure that Docker starts automatically whenever the system boots up.
sudo systemctl enable docker
-
Reboot the System
Reboot your system to apply all changes and start Docker.
sudo reboot
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
Get started with Docker by running the hello-world
container to verify the installation:
sudo docker run hello-world
If you encounter any issues, you can check Docker's logs using:
sudo journalctl -u docker