How To Install Docker on RHEL 7
(: September 24, 2019)
How to Install Docker on RHEL 7?. Docker CE installation on RHEL 7?. Containers have revolutionized Applications deployment and massive scalability of microservices. Docker was a game-changer, simplifying the process of running and managing applications in containers. This article will guide you through the installation of Docker on RHEL 7.
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
Input your username and password when prompted.
Step 2: Enable required repositories
After registering the system, enable RHEL 7 repositories which have Docker packages and dependencies.
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 on RHEL 7
We can now Install Docker on RHEL 7 by running the commands below.
sudo yum install -y docker device-mapper-libs device-mapper-event-libs sudo systemctl enable --now docker.service
Confirm service status.
$ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2019-07-14 17:10:51 EDT; 22h ago Docs: http://docs.docker.com Process: 10603 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS) Main PID: 11056 (dockerd-current) Tasks: 46 Memory: 156.8M CGroup: /system.slice/docker.service .......
Step 4: 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.
# docker pull hello-world Using default tag: latest Trying to pull repository registry.access.redhat.com/hello-world ... Pulling repository registry.access.redhat.com/hello-world Trying to pull repository docker.io/library/hello-world ... latest: Pulling from docker.io/library/hello-world 1b930d010525: Pull complete Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f Status: Downloaded newer image for docker.io/hello-world:latest # docker run --rm 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/
You now have Docker installed on RHEL 7 system. Happy containerization.