Installing Docker CE and Docker compose on RHEL8 or RHEL9
Learn how to install Docker CE and Docker compose on Red Hat Enterprise Linux (RHEL) 8 using dnf or yum commands. You can also find information about resolving Docker CE container connectivity issue in this section.
Install Docker CE and Docker compose on RHEL 8 or RHEL 9 using dnf commands
- You need a valid Red Hat subscription and account credentials to perform these actions. For detailed prerequisites, refer to Prerequisites and requirements.
- Uninstall Podman.Important: To ensure proper execution of MCM startup scripts, Podman must be uninstalled, if it is installed in BigFix MDM server. This is because the presence of Podman can create conflicts with Docker, which is used as the container runtime for MCM service.
- DNF command to remove
Podman
sudo dnf remove podman
- Yum command to remove
Podman
sudo yum remove podman sudo hash -r
- DNF command to remove
Podman
To install Docker CE and Docker compose on RHEL 8:
- Add a subscription on a RHEL 8 system. To do that, complete the following
steps:
- Register the
system:
This command prompts you to enter your Red Hat account credentials. After successful registration, the system is associated with your Red Hat account.sudo subscription-manager register
- Refresh:
This command manually refreshes the local system's subscription information.sudo subscription-manager refresh
- Attach a
subscription:
This command automatically attaches available subscriptions to your system.sudo subscription-manager attach --auto
- Register the
system:
- Add the external repository by running the following
command.
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
- Verify whether the repository has been enabled. To do that, run the
following command that returns detailed information about all the
enabled repositories.
sudo dnf repolist -v
- Verify whether the repository has been enabled. To do that, run the
following command that returns detailed information about all the
enabled repositories.
- Install the latest available containerd.io package
manually.
sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.6.28-3.2.el7.x86_64.rpm
- Install docker engine.
sudo dnf -y install docker-ce-cli sudo dnf -y install docker-ce
- Start and enable the docker
daemon
sudo systemctl enable --now docker
- Confirm whether the daemon is active by running this
command:
systemctl is-active docker
- Confirm whether the daemon is active by running this
command:
- Install docker-compose globally.
- Download the binary file from the project’s GitHub
page:
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
- After the binary file is downloaded, move it to the
/usr/local/bin folder, and then make it
executable:
sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- Download the binary file from the project’s GitHub
page:
For detailed information, see https://linuxconfig.org/how-to-install-docker-in-rhel-8
After this installation, you might encounter a Docker CE container connectivity issue. Complete these steps to resolve this issue.
Install Docker CE and Docker compose on RHEL 8 or RHEL 9 using yum
Before you begin: You need a valid Red Hat subscription and account credentials to perform these actions.
To install Docker CE and Docker compose on RHEL 8:
- Add a subscription on a RHEL 8 system. To do that, complete the following
steps:
- Register the
system:
This command prompts you to enter your Red Hat account credentials. After successful registration, the system is associated with your Red Hat account.sudo subscription-manager register
- Refresh:
This command manually refreshes the local system's subscription information.sudo subscription-manager refresh
- Attach a
subscription:
This command automatically attaches available subscriptions to your system.sudo subscription-manager attach --auto
-
sudo yum install -y yum-utils
- Register the
system:
- Add the external repository by running the following
command.
sudo yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
-
sudo yum -y install docker-ce-cli sudo yum -y install docker-ce
- Start and enable the docker
daemon
sudo systemctl enable --now docker
- Confirm whether the daemon is active by running this
command:
systemctl is-active docker
- Confirm whether the daemon is active by running this
command:
- Install docker-compose globally.
- Download the binary file from the project’s GitHub
page:
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
- After the binary file is downloaded, move it to the
/usr/local/bin folder, and then make it
executable:
sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
- Download the binary file from the project’s GitHub
page:
For detailed information, see https://linuxconfig.org/how-to-install-docker-in-rhel-8
After this installation, you might encounter a Docker CE container connectivity issue. Complete these steps to resolve this issue.
Resolve Docker CE container connectivity issue
- Check which interface Docker is using. For example,
'docker0'.
ip link show
- Check available firewalld zones. For example,
'public'
sudo firewall-cmd --get-active-zones
- Check which zone the Docker interface is bound to. Typically, the Docker
interface is not bound to a zone
yet.
sudo firewall-cmd --get-zone-of-interface=docker0
- Add the 'docker0' interface to the 'public' zone. Changes are visible only
after the firewalld is
reloaded
sudo nmcli connection modify docker0 connection.zone public
- Masquerading enables Docker ingress and
egress.
sudo firewall-cmd --zone=public --add-masquerade --permanent
- Reload the firewalld
sudo firewall-cmd --reload
- Restart dockerd
sudo systemctl restart docker