Thursday, December 26, 2024
Google search engine
HomeGuest BlogsHow To Install Docker CE on RHEL 7 Linux

How To Install Docker CE on RHEL 7 Linux

The steps shared here are for the installation of Docker CE on RHEL 7 Linux. Docker is the main dominant container runtime engine used for Development and running of micro-serviced applications in production. There are two editions of Docker available for installation on a RHEL 7 Desktop / Linux machine.

  • Docker Community Edition ( Docker CE)
  • Docker Enterprise Edition ( Docker EE)

This guide is for installation of the Docker Community Edition on RHEL 7. If you have interest in Docker Enterprise Edition, check its features and the key differences from Community edition.

So let’s install Docker CE on RHEL 7 Linux system.

Step 1: Register your RHEL 7 server

Start by registering your RHEL 7 server with Red Hat Subscription Management or Satellite server.

sudo subscription-manager register --auto-attach

You’ll be prompted to provide your Red Hat portal username and password.

Step 2: Enable required repositories

You need to enable the following repositories to install Docker Community Edition on RHEL 7. They contain a number of dependencies required to run Docker.

sudo subscription-manager repos --enable=rhel-7-server-rpms \
  --enable=rhel-7-server-extras-rpms \
  --enable=rhel-7-server-optional-rpms

Step 3: Install Docker CE on RHEL 7 Linux

Install required packages before adding the Docker CE Yum repository.

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Add stable Docker CE repository to your RHEL 7 system.

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

Finally install latest release of Docker CE on RHEL 7 with the latest and containerd.

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

If you want to view all versions of Docker available, use:

$ sudo yum list docker-ce --showduplicates | sort -r

Step 4: Start and enable Docker service

Now start and enable Docker service to start at boot.

sudo systemctl enable --now docker.service

Check docker version:

$ docker version
Client: Docker Engine - Community
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:09:51 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.13
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       906f57f
  Built:            Thu Mar 10 14:08:16 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.10
  GitCommit:        2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Step 5: Set insecure registries / Block registries

If you have local Docker registries without SSL encryption for access, you may need to whitelist them.

$ sudo vim /etc/containers/registries.conf
[registries.insecure]
registries = ["reg1.example.com","reg2.example.com"]

To block access to a registry, add the registry URL under registries.block section.

[registries.block]
registries = ['reg10.example.com']

Restart docker service if you make a change to the configuration file.

sudo systemctl restart docker

Test Docker installation on RHEL 7.

$ docker run hello-world

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/

Tags:

  • Install Docker CE on RHEL 7
  • Install Docker CE on RHEL 7 Linux
  • Docker CE installation on RHEL 7
  • Install Docker CE on RHEL 7 Server
  • Install Docker CE on RHEL 7 Workstation
  • Install Docker CE on RHEL 7 Desktop

More Container related guides.

RELATED ARTICLES

Most Popular

Recent Comments