How Do You Install the docker.service File on RHEL 8.x?

One of the following problems occurs:

Problem scenario #1
You run some systemctl commands to start the Docker service, but you get this error: "Failed to enable unit: Unit file docker.service does not exist."
Or you run some other command and see this:
"Unit docker.service not found."
What should you do to get the docker.service file on a RHEL 8.x server?

Problem scenario #2
You are running a kubeadm command on RHEL 8, but you get this error:

[preflight] Running pre-flight checks
[WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
[WARNING IsDockerSystemdCheck]: detected "" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[WARNING FileExisting-ebtables]: ebtables not found in system path
[WARNING FileExisting-socat]: socat not found in system path
[WARNING FileExisting-tc]: tc not found in system path

You cannot find a docker.service file either. What should you do?
How do you troubleshoot "docker service is not enabled" when you run a kubeadm command?

Solution
Run these commands (but replace "rhel" with "centos" if you are using CentOS:
sudo dnf config-manager --add-repo=https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install docker-ce
sudo systemctl enable docker.service

Leave a comment

Your email address will not be published. Required fields are marked *