The steps shared here are for installing Docker CE on RHEL 7 Linux. Docker is the main main container runtime engine used to develop and run microservice applications in production. There are two versions of Docker that can be installed on RHEL 7 Desktop / Linux machines.
- Docker Community Edition (Docker CE)
- Docker Enterprise Edition (Docker EE)
This guide is for installing Docker Community Edition on RHEL 7. If you are interested in Docker Enterprise Edition, Check its function And the main differences from the community edition.
So let’s install Docker CE on a RHEL 7 Linux system.
Step 1: Register your RHEL 7 server
First register the RHEL 7 server with Red Hat Subscription Management or Satellite server.
sudo subscription-manager register --auto-attach
You will be prompted to provide your Red Hat Portal username and password.
Step 2: Enable the required repositories
You need to enable the following repositories to install Docker Community Edition on RHEL 7. They contain many of the dependencies needed 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 the 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 the latest version of Docker CE on RHEL 7 with the latest container.
sudo yum install docker-ce docker-ce-cli containerd.io
If you want to see all available Docker versions, use:
$ sudo yum list docker-ce --showduplicates | sort -r
Step 4: Start and enable the Docker service
Now start and enable the Docker service to start at startup.
sudo systemctl enable --now docker.service
Check docker version:
$ docker version Client: Docker Engine - Community Version: 19.03.7 API version: 1.40 Go version: go1.12.17 Git commit: 7141c199a2 Built: Wed Mar 4 01:24:10 2020 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.7 API version: 1.40 (minimum version 1.12) Go version: go1.12.17 Git commit: 7141c199a2 Built: Wed Mar 4 01:22:45 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683
Step 5: Setting up an insecure registry / blocking registry
If you have a local Docker registry that is not accessed using SSL encryption, you may need to whitelist them.
$ sudo vim /etc/containers/registries.conf ..... [registries.insecure] registries = ["reg1.example.com","reg2.example.com"]
To prevent access to the registry, add the registry URL below Registry block section.
[registries.block] registries = ['reg10.example.com']
If you make changes to the configuration file, restart the docker service.
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/
- Install Docker CE on RHEL 7
- Install Docker CE on RHEL 7 Linux
- Install Docker CE 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 guidelines.
Setting up a local OpenShift 4.2 cluster with a CodeReady container
Manage Docker containers with Docker Compose
Install Kubernetes cluster using RKE