Building Docker for POWER

This blogpost aims to teach how to build and create a Docker .deb and .rpm packages starting from Docker 20.10 release, considering that since that version the Docker Engine and Docker CLI are built directly from the source repositories.

tf logo


We used Ubuntu 20.04 for this tutorial for both .deb and .rpm builds.
First, make sure you have both git and the make package on your machine.
You can install then with:

sudo apt install git
sudo apt install make
sudo apt install unzip

After that, we need to install Docker-CE. To do that, just add our POWER packages repository to your machine:

Edit the file /etc/apt/sources.list by adding the following line:

deb ./

Download our GPG key, and use the command below to add it to the system:

sudo apt-key add openpower-gpgkey-public.asc

After that, update the package list and install docker-ce:

sudo apt update
sudo apt install docker-ce

More information about our repository in: POWER Repository

Build and Packaging

We’ll need to download docker-cli and moby (current name of the docker engine) and clone the repositories from scan-cli-plugin and docker-ce-packaging.
Clone the following docker repositories:

git clone
git clone

Download the desired version (we’ll use 20.10.6) of the cli and moby by downloading its releases (you can use git clone to build the master branch too):

# Download the cli source code and change its zip name

# Download the moby source code and change its zip name

# Unzip the downloaded source-codes

#Change the folders name
mv cli-20.10.6 cli
mv moby-20.10.6 moby

Because the Docker Build uses, we need to modify two files on docker-ce-packaging in order to use the community version of the same software, which is probably already installed on your machine if you installed Docker-CE from our repository(POWER Repository).
Besides that

Modify the files with python3 by running the following script:

import re

print("Running Patching Script...")

deb_path = "docker-ce-packaging/deb/common/control"
deb_ver = "containerd (>= 1.2.1)"

rpm_path = "docker-ce-packaging/rpm/SPECS/docker-ce.spec"
rpm_ver = "Requires: containerd >= 1.2.1"

# Update debian containerd dependency
print("Patching DEB...")
deb = open(deb_path, 'r')
data =
new = re.sub(r' \([^)]*\)', deb_ver, data)
assert data != new, "Nothing was changed in the file."
open(deb_path, 'w').write(new)

# Update rpm containerd dependency
print("Patching RPM...")
rpm = open(rpm_path, 'r')
data =
new = re.sub(r'Requires: [^\n]*', rpm_ver, data)
assert data != new, "Nothing was changed in the file."
open(rpm_path, 'w').write(new)

print("DONE Patching")

After the patch is done, we need to create specific folders inside docker-ce-packaging and copy the other cloned repositories into that folders.

From the outside of docker-ce-packaging, do that with:

# Create the folders
mkdir -p docker-ce-packaging/src/
mkdir -p docker-ce-packaging/src/
mkdir -p docker-ce-packaging/src/

# Copy cli, moby and scan-cli-plugin
sudo cp -r cli/* docker-ce-packaging/src/
sudo cp -r moby/* docker-ce-packaging/src/
sudo cp -r scan-cli-plugin/* docker-ce-packaging/src/

Making .deb packages

Systems available:
ubuntu-buster, ubuntu-bionic, ubuntu-focal, ubuntu-groovy, ubuntu-hirsute, ubuntu-xenial
debian-bullseye, debian-buster
raspbian-bullseye, raspbian-buster

Make the packages with:

cd docker-ce-packaging/deb
sudo VERSION=20.10.6 make ubuntu-focal

They will be available at: docker-ce-packaging/deb/debbuild/
In our example, the .deb files will be at

deb files

Making .rpm packages

Edit the file docker-ce-packaging/rpm/gen-rpm-ver
by changing the characters || to && in line 46

Systems available:
centos-7, centos-8
fedora-32, fedora-33, fedora-34

Make the packages with:

cd docker-ce-packaging/rpm
sudo VERSION=20.10.6 make centos-8

They will be available at: docker-ce-packaging/rpm/rpmbuild/
In our example, the .rpm files will be at
docker-ce-packaging/rpm/rpmbuild/centos-8/SRPMS and

rpm files


Docker CLI:
Docker Engine:
Docker-CE Packaging:

Matheus Fernandes
Computer Engineering undergrad student

I’m an undergrad student in Computer Engineering at UNICAMP.