Docker is a series of frameworks that are using OS-level virtualization to provide applications in bundles called containers as service items. Containers are isolated from each other, and their programs, folders, and configuration files are packaged. They can communicate with each other via well-defined platforms. So, in this article, we will discuss how to install and configure Docker on your Oracle Linux 8 system.
Prerequisites
- The Oracle Linux 8 must be installed on your Virtual Box Machine.
- The user should have root user rights to install Docker.
Log in as a Sudo User
Open your Oracle Linux 8 from your virtual box and login from it. Then, open your terminal in Oracle Linux 8 and make sure to login as a root user using the following sudo command:
$ suIt will ask you for your root user password, and you have to provide it to proceed with the further processes appended below.
If you have already installed some repositories of Docker, then you have to remove them using the affixed yum command:
# sudo yum remove docker docker-common docker-selinux docker-engine
Install Required Repositories and Utilities
At the very start, you have to install and enable some repositories that are useful and necessary for the installation of Docker. So at first, you have to install yum utilities. For this purpose, execute the command cited below:
# sudo dnf install -y dnf-utils zip unzipMake sure to try these commands with sudo privileges, otherwise, it may not work properly.
Secondly, you have to install and download the configuration repository for Docker, which is docker-ce. Use the appended command below in your terminal using sudo initialization:
# sudo dnf config-manager -add-repo=https://download.docker.com/linux/centos/docker-ce.repo
Install Docker
Finally, you can install Docker on your Oracle Linux 8. Make sure to login as a root user. Use the following cited command to install Docker in Oracle Linux 8 via terminal:
$ sudo dnf install -y docker-ce --nobest
If you are unable to install Docker by using the above command, and you are facing some errors, there are some ways to resolve these. Try this command with the addition of the “allowing erasing” key at the end of it, as shown below:
# sudo dnf install -y docker-ce -nobest -allowerasingYou can also use the appended command below:
# sudo dnf install -y docker-ce -nobest -skip-broken
You can see your installation has begun. You have to wait for some time until it installs your Docker on Oracle Linux 8 successfully.
Enable Docker Service
To start using Docker, you have to enable your docker service in Oracle Linux 8. For this, use the following systemctl command as a root user:
# systemctl enable docker.serviceThis command will enable Docker on your Oracle Linux 8.
It may also require authentication by asking for your password for the current user by which you are logged in.
After enabling, you can start the Docker service by using the following systemctl command:
# systemctl start docker.service
Check Status
You can also check the status of your newly installed Docker service, whether it is working properly or not. To find out the status of Docker, try the below-mentioned systemctl status command in the terminal:
# systemctl status docker.serviceAs clear from the image below that the newly installed Docker Engine is currently Active and running properly with no errors.
Check for Docker Info
Luckily, you can check for the info of the Docker that has just been installed on your Oracle Linux 8. To do so, try the below command as follows:
# docker infoMake sure to login as a root user first. Your system will display all the related information regarding Docker, as shown in the image.
Check for Docker Version
Also, if you want to check the installed version of Docker on your Oracle Linux 8, use the command as follows:
# docker version
Create User with Sudo Privileges
Finally, your Docker is ready to use. If you don't want to use a sudo account, then you have to assign the sudo privileges to another user to run docker commands. First of all, make a new user from the root account as follows:
# useradd docker_user
Add the Sudo User to a Group
Add this newly created user in the /etc/sudoers file to make its entry clear, as follows:
# echo “docker_user ALL-(ALL) NOPASSED: /usr/bin/docker” >> /etc/sudoers
After adding this user to the sudoers file, you have to create a group and assign it to the user that has just been created as a sudo user. To do this, use the following command:
# echo “alias docker=\”sudo /usr/bin/docker\”” >> /home/docker_user/.bash_profileWe have used an alias in this newly created user's bash_profile file to avoid any further use of sudo in your command.
Login as Newly Created Sudo User
Now, you have to login as a sudo user that you have especially created for Docker to try commands. Use Docker as a sudo user through the following command to switch to a newly created sudo user:
#su - docker_userIt may ask for your password to confirm your action. As for our case, we did not set a password, so it will not ask for docker_user password, as shown below.
Now, you can finally start using Docker through different commands as a sudo user.
Conclusion
We have discussed and learned about very simple and efficient methods of installing Docker on Oracle Linux 8. In this article, we have educated ourselves about the basic installation and use of Docker. Hopefully, this article has facilitated a lot to make you understand Docker installation and its use.