Docker is a platform software for containers. Initially docker used the LXC and later it has replaced with its own component which is written in Go programming language.
You can use this bash script many times for installing docker on CentOS 8 / Red Hat 8.
Steps to install docker
1. Create a new bash script file. We are using vi editor for creating the file.
2. Paste the given below content in bash script file, save and exit.
#!/bin/bash # Description: Install Docker On CentOS 8 # Blog: https://sharadchhetri.com # disable selinux- permanently and temporarily sudo sed -i.bak 's/enforcing/disabled/g' /etc/selinux/config sudo setenforce 0 # add the docker yum repo sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo # Install docker sudo dnf -y install docker-ce docker-ce-cli containerd.io --nobest # Enable the docker service sudo systemctl enable --now docker # Add the currently login user in group called 'docker' sudo usermod -aG docker $USER # Stop and disable firewalld service sudo systemctl stop firewalld sudo systemctl disable firewalld # logout (you can also do system restart to make docker effectively working) logout
3. Make the script executable.
sudo chmod +x install_docker_centos8.sh
4. Execute the installation bash script
Note: The script will logout automatically so save and close your applications before running this script.
Login back to system and check the docker.
Lets test by pulling one docker image.
docker pull httpd
Your installation of docker on CentOS 8 should be completed. This script you can also use this script in Red Hat 8.