8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Linux » Here

Docker : Install Docker on Oracle Linux 8 (OL8)

This article demonstrates how to install Docker on Oracle Linux 8 (OL8). RHEL8, and therefore OL8, have switched their focus from Docker and on to Podman (here) for containers, so this installation uses the Docker CE installation from the Docker repository.

Related articles.

Assumptions

This article makes the following assumptions.

Install Docker

Enable all the required repositories. To do this you are going to need the yum-utils package.

dnf install -y dnf-utils zip unzip
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Install Docker.

dnf install -y docker-ce --nobest

Configure Disk (Optional)

By default the containers are created under the "/var/lib/docker", so you really need to house this on a separate disk or in a separate partition.

I have a second LUN with a device named "/dev/sdb". I could build the file system on this disk directly, but I prefer to partition the disks with a single partition using fdisk..

MOUNT_POINT=/var/lib/docker
DISK_DEVICE=/dev/sdb

# New partition for the whole disk.
echo -e "n\np\n1\n\n\nw" | fdisk ${DISK_DEVICE}

# Add file system.
mkfs.xfs -f ${DISK_DEVICE}1

# Mount it using the UUID of the VirtualBox virtual disk.
# rm -Rf /var/lib/docker
# mkdir /var/lib/docker
UUID=`blkid -o export ${DISK_DEVICE}1 | grep UUID | grep -v PARTUUID`
mkdir ${MOUNT_POINT}
echo "${UUID}  ${MOUNT_POINT}    xfs    defaults 1 2" >> /etc/fstab
mount ${MOUNT_POINT}

Finish Docker Setup

Enable and start the Docker service.

# systemctl enable docker.service
# systemctl start docker.service

You can get information about docker using the following commands.

# systemctl status docker.service
# docker info
# docker version

You are now ready to start using Docker!

Docker Commands as Non-Root User

Docker commands run as the "root" user. You have three choices when if comes to running docker commands.

In this case we want to run the docker commands from a user called "docker_user", so we add an entry in the "/etc/sudoers" file and use an alias in the user's ".bash_profile" file so we don't have to keep typing the "sudo" command.

# useradd docker_user
# echo "docker_user  ALL=(ALL)  NOPASSWD: /usr/bin/docker" >> /etc/sudoers
# echo "alias docker=\"sudo /usr/bin/docker\"" >> /home/docker_user/.bash_profile
# su - docker_user
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
$

For more information see:

Hope this helps. Regards Tim...

Back to the Top.