How to install Docker CE on Oracle Linux 8/7

Oracle Linux is an open-source server Linux distro and a good alternative to CentOS and RHEL Linux distributions. Moreover, as CentOS 8 Linux life will end this year, in such scenarios Oracle Linux 8 is a viable option. Of course, there are some other projects in progress to provide alternatives to CentOS such as Rocky Linux, however, they are still in the incubation period.

Well, here we are going to discuss the steps to install the Docker Community Edition on Oracle Linux to create containers. Docker is the containerized platform that allows users to run multiple isolated virtual machines using the docker images. You can create your own image or use any of the available on Docker Hub.

Install Docker Engine on Oracle Linux 8 or 7

1. Run system update

First of all, run the system update command to rebuild the repo cache and update installed packages.

sudo yum update

 

2. Install Yum Config-manager

To add a repository without going through the repo file and edit to insert a repository URL, we can use the yum-config-manager tool. If you are using a minimal server version then you perhaps not have it. Thus, here is the command to install it.

sudo yum install -y yum-utils

 

3. Add Docker repository to Oracle Linux

Well, as Oracle is just like CentOS, thus we can use the CentOS repository officially available for users by Docker developers. And here is the command to add the same on Oracle Linux 8 or 7.

sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Run system update:

sudo yum update

 

4. Command to install Docker-Ce on Oracle Linux

To install Docker Engine, command line and contained (a standalone high-level container runtime) run, finally, this command…

sudo yum install docker-ce docker-ce-cli containerd.io

OutPut:

==============================================================================
Package Arch Version Repository Size
==============================================================================
Installing:
containerd.io x86_64 1.4.3-3.1.el8 docker-ce-stable 33 M
docker-ce x86_64 3:20.10.2-3.el8 docker-ce-stable 27 M
docker-ce-cli x86_64 1:20.10.2-3.el8 docker-ce-stable 33 M
Installing dependencies:
checkpolicy x86_64 2.9-1.el8 ol8_baseos_latest 346 k
container-selinux noarch 2:2.144.0-1.module+el8.3.0+7866+f387f528
ol8_appstream 49 k
docker-ce-rootless-extras x86_64 20.10.2-3.el8 docker-ce-stable 9.1 M
fuse-overlayfs x86_64 1.1.2-3.module+el8.3.0+7866+f387f528
ol8_appstream 67 k
fuse3-libs x86_64 3.2.1-12.0.2.el8 ol8_baseos_latest 95 k
libcgroup x86_64 0.41-19.el8 ol8_baseos_latest 70 k
libslirp x86_64 4.3.1-1.module+el8.3.0+7866+f387f528
ol8_appstream 69 k
policycoreutils-python-utils noarch 2.9-9.0.1.el8 ol8_baseos_latest 251 k
python3-audit x86_64 3.0-0.17.20191104git1c2f876.el8
ol8_baseos_latest 86 k
python3-libsemanage x86_64 2.9-3.el8 ol8_baseos_latest 127 k
python3-policycoreutils noarch 2.9-9.0.1.el8 ol8_baseos_latest 2.2 M
python3-setools x86_64 4.3.0-2.el8 ol8_baseos_latest 626 k
slirp4netns x86_64 1.1.4-2.module+el8.3.0+7866+f387f528
ol8_appstream 50 k
Enabling module streams:
container-tools ol8

Transaction Summary
==============================================================================
Install 16 Packages

Total download size: 106 M
Installed size: 433 M
Is this ok [y/N]: Y

 

5. Enable and start docker service

Once the docker is installed run its daemon and mark it enabled, so that it can start automatically with system boot.

sudo systemctl start docker

sudo systemctl enable docker

6. Check Docker is running

sudo docker run hello-world

 

7. Add User to Docker group

By default, docker needs the root access to run commands, thus without using sudo, you will get this error:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=ubuntu&tag=latest: dial unix /var/run/docker.sock: connect: permission denied

Therefore, we add our current or the user that you want to use to access docker to the docker group, hence we won’t need sudo usage with docker commands.

 sudo groupadd docker

 sudo usermod -aG docker your_user
 newgrp docker

Note: Replace the your_user with your user. If you don’t know what is your username then run:

whoami

Test docker again without sudo 

docker pull ubuntu

Run it :

docker run -it ubuntu

 

Add user to docker in oracle linux

 

1 thought on “How to install Docker CE on Oracle Linux 8/7”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.