Atlantic.Net Blog

How to Install Docker and Docker Compose on Oracle Linux 8

Hitesh Jethva
by Atlantic.Net (414 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Docker is a free and open-source containerization platform that allows developers to package applications into containers. Docker uses OS-level virtualization to deliver software in packages called containers. It allows you to create, build and run lightweight and portable application images for any platform.

Docker Compose is a free and open-source tool that helps you to define and share multi-container applications in a single YAML file. With Docker Compose, you can run and connect multiple containers as a single service.

In this post, we will show you how to install Docker and Docker Compose in Oracle Linux 8.

Prerequisites

  • A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 4GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Docker CE

By default, the latest version of the Docker package is not included in the Oracle Linux default repository, so you will need to create a Docker CE repo.

You can create it using the following command:

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

Next, run the following command to install Docker CE on your server.

dnf install docker-ce -y

After the installation, start the Docker service and enable it to start at system reboot.

systemctl start docker
systemctl enable docker

Next, verify the running status of the Docker service using the following command:

systemctl status docker

Sample output:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-04-30 08:35:46 EDT; 6s ago
     Docs: https://docs.docker.com
 Main PID: 8554 (dockerd)
    Tasks: 8
   Memory: 31.7M
   CGroup: /system.slice/docker.service
           └─8554 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Apr 30 08:35:45 oraclelinux dockerd[8554]: time="2022-04-30T08:35:45.932297676-04:00" level=error msg="Failed to built-in GetDriver graph btr>
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.249687493-04:00" level=warning msg="Your kernel does not support cgroup >
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.249732672-04:00" level=warning msg="Your kernel does not support cgroup >
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.249960144-04:00" level=info msg="Loading containers: start."
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.682620546-04:00" level=info msg="Default bridge (docker0) is assigned wi>
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.861304346-04:00" level=info msg="Loading containers: done."
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.884014323-04:00" level=info msg="Docker daemon" commit=87a90dc graphdriv>
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.884186171-04:00" level=info msg="Daemon has completed initialization"
Apr 30 08:35:46 oraclelinux systemd[1]: Started Docker Application Container Engine.
Apr 30 08:35:46 oraclelinux dockerd[8554]: time="2022-04-30T08:35:46.934543023-04:00" level=info msg="API listen on /var/run/docker.sock"

You can also verify the Docker version with additional information using the following command:

docker info

You will get the following output:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.1-docker)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:

Step 3 – Verify Docker Installation

At this point, Docker is installed and running. Now it’s time to test whether it’s working or not.

You can download and run Docker’s hello-world container to test Docker.

docker run hello-world

This will download and run the hello-world Docker container on your system:

latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

You can use the “docker images” command to verify the downloaded image:

docker images

You will get the following output:

REPOSITORY    TAG       IMAGE ID       CREATED        SIZE
hello-world   latest    feb5d9fea6a5   7 months ago   13.3kB

Step 4 – Install Docker Compose

By default, the latest version of Docker Compose is not available in the Oracle Linux default repository, so you will need to download it from the Git Hub repository.

First, install the curl command utility with the following command:

dnf install -y curl

Next, download the latest version of Docker Compose using the following command:

curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

Next, set executable permission on the Docker Compose binary:

chmod +x /usr/local/bin/docker-compose

Next, verify the Docker Compose version using the following command:

docker-compose --version

You will get the following output:

Docker Compose version v2.5.0

Step 5 – Remove Docker and Docker Compose

If you want to remove the Docker package from your system, you will need to stop the Docker service first:

systemctl stop docker

Next, remove the Docker package using the following command:

dnf remove docker-ce -y

To remove Docker Compose, delete the Docker Compose binary using the following command:

rm -rf /usr/local/bin/docker-compose

Conclusion

In this guide, you learned how to install Docker and Docker Compose on Oracle Linux 8. You can now install both on your development environment and deploy an application in the Docker environment. Give it a try on your dedicated server from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Top 10 Best Cybersecurity Training Services
How to Install Ansible on Oracle Linux 8
How to Install LEMP Server on Oracle Linux 8
How to Install and Configure Apache Webserver on Oracle Linux 8
How to Install and Configure Nginx Webserver on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources