What is Oracle Linux?
Oracle Linux is a Linux distribution packaged and freely distributed by Oracle, available partially under the GNU General Public License since late 2006. It is compiled from Red Hat Enterprise Linux source code, replacing Red Hat branding with Oracle's
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 and Update Repo
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
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
Sample output as below, type "Y" and hit Enter
Dependencies resolved.
=======================================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================================
Installing:
containerd.io x86_64 1.6.6-3.1.el8 docker-ce-stable 33 M
docker-ce x86_64 3:20.10.17-3.el8 docker-ce-stable 22 M
docker-ce-cli x86_64 1:20.10.17-3.el8 docker-ce-stable 29 M
Installing dependencies:
container-selinux noarch 2:2.179.1-1.module+el8.6.0+20665+a3b29bef ol8_appstream 58 k
docker-ce-rootless-extras x86_64 20.10.17-3.el8 docker-ce-stable 4.7 M
fuse-common x86_64 3.3.0-15.0.2.el8 ol8_baseos_latest 22 k
fuse-overlayfs x86_64 1.8.2-1.module+el8.6.0+20665+a3b29bef ol8_appstream 73 k
fuse3 x86_64 3.3.0-15.0.2.el8 ol8_baseos_latest 55 k
fuse3-libs x86_64 3.3.0-15.0.2.el8 ol8_baseos_latest 95 k
libcgroup x86_64 0.41-19.el8 ol8_baseos_latest 70 k
libslirp x86_64 4.4.0-1.module+el8.6.0+20665+a3b29bef ol8_appstream 70 k
slirp4netns x86_64 1.1.8-2.module+el8.6.0+20665+a3b29bef ol8_appstream 51 k
Installing weak dependencies:
docker-scan-plugin x86_64 0.17.0-3.el8 docker-ce-stable 3.8 M
Enabling module streams:
container-tools ol8
Transaction Summary
=======================================================================================================================================================
Install 13 Packages
Total download size: 93 M
Installed size: 389 M
Is this ok [y/N]:
if you are running any error, you may need to enable the developer package
sudo yum-config-manager --enable ol7_developer
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. 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 usermod -aG docker ${USER}
Once done, you need to logout and login back to take this change affect
Note: Replace the {USER} with your username.
7. Install Docker Compose
This is an optional step, you are planning to use compose file, you may need docker-compose
plugin
sudo yum update
sudo yum install docker-compose-plugin
Verify that Docker Compose is installed correctly by checking the version
docker compose version
8. Test the installation
You can run hello-world docker to test the installation
sudo docker run hello-world