Welcome lovely people to today’s guide on how to install Docker CE on Rocky Linux 8 / AlmaLinux OS 8. Docker CE is a free to use and open source containerization platform designed to run on Windows, Linux and macOS. The CE version of Docker is a rebrand of the Docker open source solution. There is an Enterprise Edition if you need support from Docker Inc on your container platform.
Docker is used throughout the development lifecycle from Development to Production – for fast, easy and portable application development, both on-prem and in the cloud. The Docker’s comprehensive end to end platform includes UIs, CLIs, APIs and security that are engineered to work together across the entire application delivery lifecycle.
In this guide we will walk you through the installation of Docker CE on AlmaLinux OS 8. AlmaLinux OS is an open source Linux distribution derived from RHEL source. It is created by the community and for the community.
Step 1: Update AlmaLinux / Rocky Linux 8 System
Start the installation by updating AlmaLinux / Rocky Linux 8 system OS packages to the latest versions.
sudo dnf -y update
If you have kernel related updates it is recommended to perform a system restart:
Step 2: Add Docker CE repository
There is an open Docker CE repository with rpm packages for Red Hat based Linux systems. We’ll add this repository before we can install Docker CE on Rocky Linux 8 / AlmaLinux OS 8.
Install yum-utils which provides yum-config-manager command line tool.
sudo dnf install -y yum-utils
Once the tool is installed run the commands below to add Docker CE repository to your AlmaLinux / Rocky Linux 8 system:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Confirm repository is available for use:
$ sudo dnf repolist repo id repo name appstream AlmaLinux 8 - AppStream baseos AlmaLinux 8 - BaseOS docker-ce-stable Docker CE Stable - x86_64 epel Extra Packages for Enterprise Linux 8 - x86_64 epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64 extras AlmaLinux 8 - Extras powertools AlmaLinux 8 - PowerTools
Step 3: Install Docker CE on Rocky Linux 8 / AlmaLinux 8
Now that Docker repository has been added to our system we can proceed to install Docker CE on AlmaLinux 8 / Rocky Linux 8:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
The commands above will install the latest version of Docker Engine and containerd.
================================================================================================================================================================== Install 12 Packages Total download size: 107 M Installed size: 438 M
Wait for the installation commands to complete then start the service:
sudo systemctl enable --now docker
Check 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 Wed 2021-04-21 12:38:02 EAT; 15s ago Docs: https://docs.docker.com Main PID: 73811 (dockerd) Tasks: 11 Memory: 48.9M CGroup: /system.slice/docker.service └─73811 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Apr 21 12:38:01 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:01.563762210+03:00" level=warning msg="Your kernel does not support cgroup blkio> Apr 21 12:38:01 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:01.563813612+03:00" level=warning msg="Your kernel does not support cgroup blkio> Apr 21 12:38:01 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:01.564044629+03:00" level=info msg="Loading containers: start." Apr 21 12:38:02 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:02.354851079+03:00" level=info msg="Default bridge (docker0) is assigned with an> Apr 21 12:38:02 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:02.488424916+03:00" level=info msg="Firewalld: interface docker0 already part of> Apr 21 12:38:02 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:02.635890639+03:00" level=info msg="Loading containers: done." Apr 21 12:38:02 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:02.658887803+03:00" level=info msg="Docker daemon" commit=8728dd2 graphdriver(s)> Apr 21 12:38:02 almalinux.computingpost.com dockerd: time="2021-04-21T12:38:02.659112755+03:00" level=info msg="Daemon has completed initialization" Apr 21 12:38:02 almalinux.computingpost.com systemd: Started Docker Application Container Engine.
Add your user to docker group
sudo usermod -aG docker $USER newgrp docker
Confirm if you’re able to run any docker commands without sudo:
$ docker --version Docker version 20.10.17, build 100c701
Step 4: Run docker container
Let’s test our Docker CE installation on AlmaLinux 8 / Rocky Linux 8 by pulling alpine linux and hello-world images:
$ docker pull alpine:latest latest: Pulling from library/alpine 540db60ca938: Pull complete Digest: sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f Status: Downloaded newer image for alpine:latest docker.io/library/alpine:latest $ docker pull hello-world Using default tag: latest latest: Pulling from library/hello-world b8dfde127a29: Pull complete Digest: sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519 Status: Downloaded newer image for hello-world:latest docker.io/library/hello-world:latest
Run a docker container from the alpine image:
$ 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/
We can confirm our Docker installation on AlmaLinux OS 8 / Rocky Linux 8 is working fine. You can now build your containerized applications with Docker and helpful tools such as Docker Compose. And eventually migrating them to Kubernetes environment.