Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

docker-rpm-builder

> DevOps
Open source

Build native RPM packages for Centos/RHEL/Fedora from any Linux distro or even OSX, by leveraging docker capabilities.

387 stars0 likes2 views
WebsiteGitHub

About

Build native RPM packages for Centos/RHEL/Fedora from any Linux distro or even OSX, by leveraging docker capabilities.

News

CALL FOR DEVELOPERS version 2.0: I made a configuration mistake on mail filters and I wouldn't read many github notification for the past year, so I might not have read help offers. Now my filters are properly configured.

docker-rpm-builder once was quite relevant to my daily job, so I took the time to write and support it. But it is less and less relevant to me, and it requires constant maintenance (new distros come, old distros go, features are requested, et cetera). I would appreciate some help. Write a response to https://github.com/alanfranz/docker-rpm-builder/issues/51 and become a developer!

IMPORTANT: Docker has changed the distribution repos (both APT and YUM) for its packages. See the updated instructions and repos at docs.docker.com. The new free package is called docker-ce.

IMPORTANT: The APT and YUM repos have changed! Check the new URLs down there!

IMPORTANT: since 1.33, docker-rpm-builder won't force a dependency on a specific docker package, you must install a docker distribution yourself - see prerequisites.

See the News Page for all the latest news.

See also FPM within Docker - an alternative way of building RPMs and DEBs that could make things even easier for you.

Donate!

docker-rpm-builder is got a number of faithful users and followers; now you can donate to the project, not in the form of money (maybe I'll start accepting some BTC in the near future, but not right now) but in the form of goods; if you find this project useful and you'd like to reward me for my work, you can buy me something from my Amazon wish list.

Table of Contents

  • News
  • Donate!
  • Table of Contents
  • For whom is this software designed?
  • Why?
  • Key features
  • Limitations
  • Required knowledge
  • Installation
    • Prerequisites
      • Docker configuration
    • CentOS 7.x / RHEL 7.x
      • Support plan
    • Fedora
      • Support plan
    • Debian Jessie + Stretch
      • Support plan
    • Ubuntu (multiple releases)
      • Support plan
    • Arch Linux
      • Support plan
    • Other distributions and OSX - installing straight from source
  • Test everything works!
  • Usage
    • Building a binary RPM straight from a directory
      • Example
    • Spectemplates
    • Manually generating specfile to enable caching of build dependencies
    • Rebuilding a source RPM
    • Chainbuild: build both a source and a binary rpm
    • Build images
      • Prebuilt images
  • Gotchas
  • Contacts
  • Thanks
  • TODOS and ideas
  • Disclaimer

For whom is this software designed?

If you already know a bit about RPM packaging, and you're quite confident reading or writing a specfile, either because you need to (e.g. you've got a package that needs very fine tuning) or because you must (e.g. you need your package to work in existing distributions' workflows where a .src.rpm and a specfile are required).

If you just need to package your software in an RPM and don't care too much about conventions, fine tuning, ecc, take a look at FPM within Docker. It'll make your life easier without much fuss.

Why?

If you think that:

  • using plain rpmbuild is painful because it requires you to setup a server/vm with the same OS as the build target and then transfer your development code, then reset the build environment to prevent leftovers to alter your future builds, and/or
  • mock could be better because a) it's a complex piece of software that makes debugging failed builds a bit hard, b) sometimes produces errors which are not so easy to understand without digging into its source code, and c) is very hard to run on non-RHEL/Centos/Fedora host distros, and/or
  • hosted build systems like copr or OBS feel slower or simply too complex for the task at hand

then you're in the right place.

Basically, docker-rpm-builder is an ecosystem comprising a way to run rpmbuild inside docker-based containers. Both the tool and a basic set of target build images is included.

Key features

  • Works on any host distribution that supports docker.
  • It's very small and hackable. Take a look at the source code: making modifications is trivial.
  • Can build straight from the source directory without an intermediate .src.rpm
  • It supports a basic templating system for specfiles, which is especially useful in CI contexts.
  • It lets you spawn an interactive shell if the build fails, in the very place where it fails
  • If you use a precise build image and hold all build dependencies within, your builds will be highly reproducible.
  • Cache build dependencies; don't re-download unless your spec changes.
  • The root filesystem is fully writable, letting you install to the 'real' target directory and moving to $RPM_BUILD_ROOT at the end of the build - that's very useful for compiled software that doesn't support PREFIX and after-install relocation properly. Such writes are not persisted within the build image,

Limitations

  • Currently limited to x86_64 for both host and target. That's a docker limitation which is unlikely to go away soon. 32 bit container images for Docker do exist, but they're considered unsupported by this tool.

Required knowledge

You should have a vague idea of what docker is and you should already know how to build an RPM - see to Maximum RPM and other documentation from Fedora HowTO / RPM Guide.

Installation

Prerequisites

IMPORTANT: A Docker distribution is required in order to use this tool. I recommend using the latest stable docker-ce RPM or DEB, use prebuilt packages package from yum.dockerproject.org or apt.dockerproject.org; just follow the official install instructions.

At the dawn of this tool, I tried to make it work with any version of docker that would come from the distributions' repository or from official repository. This proved to be quite troublesome, but at the same time, different distributions are repackaging the docker CLI and daemon in different ways, and users have different priorities. So, since version 1.33 docker-rpm-builder no longer forces a dependency on any docker package on your system. Feel free to use whatever docker version you like; just be aware that I usually test docker-rpm-builder using the official docker-ce packages.

Python 2.7, bash, and wget should be installed on your system as well. If you're using a packaged version, the package will take care of that.

Please note: docker runs on the host system; it is irrelevant whether the target distribution would be able to run docker - in fact you can build Centos/RHEL 5 and 6 packages perfectly.

See the section below for details on some post-install actions for docker.

Docker configuration

If docker is already up and running on your system, you probably need to do absolutely nothing else.

Otherwise, if it's your first time with docker, here's a checklist:

  • Verify you've installed a docker distribution - see prerequisites.
  • Verify the docker service is running
  • Verify the docker group exists and your user belongs to it. It is advised not to run docker-rpm-builder as root. The docker package on some recent Fedoras seems to add a dockerroot group instead - it won't do!
  • If you had to add the group, verify you've restarted the docker service after such addition
  • Verify you've logged out+in after adding your user to the group
  • If you get strange errors, try checking whether SELinux is enabled, and try disabling it to see if the situation changes. As of 1.36, docker-rpm-builder should be compatible with SELinux, but it wasn't thoroughly tested.
  • Verify your disk has enough free space

CentOS 7.x / RHEL 7.x

CentOS 6 / RHEL 6 support for docker-rpm-builder has been discontinued along docker's own support. I'm sorry. If you really need to use such distros, you can try the source install described below, along with docker 1.7.

/etc/yum.repos.d/docker-rpm-builder-v1.repo

[docker-rpm-builder-v1]
name=docker-rpm-builder-v1
baseurl=https://dl.bintray.com/alanfranz/drb-v1-centos-7
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://www.franzoni.eu/keys/D1270819.txt
       https://www.franzoni.eu/keys/D401AB61.txt

Now, just:

bash
yum install docker-rpm-builder

And you're done; if you haven't already done so, check the docker configuration section, then launch the test suite

Support plan

I plan to support the latest CentOS/RHEL stable.

Fedora

Use this yum repository:

/etc/yum.repos.d/docker-rpm-builder-v1.repo

[docker-rpm-builder-v1]
name=docker-rpm-builder-v1
baseurl=https://dl.bintray.com/alanfranz/drb-v1-fedora-$releasever
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://www.franzoni.eu/keys/D1270819.txt
       https://www.franzoni.eu/keys/D401AB61.txt
dnf install docker-rpm-builder

And you're done; if you haven't already done so, check the docker configuration section, then launch the test suite

Support plan

I plan to support the latest two Fedora releases,unless something bad happens (i.e. the official docker-package is not released anymore for the older fedora), so currently fc26 and fc27 are supported.

Debian Jessie + Stretch

First, you should make sure that Bintray's package signing key properly installed and configured for apt:

bash
curl https://www.franzoni.eu/keys/D401AB61.txt | sudo apt-key add -

And you should make sure the apt-transport-https package is installed.

Then, pick the repo for your distribution - see below - and save it as /etc/apt/sources.list.d/docker-rpm-builder.list

deb https://dl.bintray.com/alanfranz/drb-v1-debian-jessie jessie main

or

deb https://dl.bintray.com/alanfranz/drb-v1-debian-stretch jessie main

Now you're ready to

apt-get update
apt-get -y install docker-rpm-builder

And you're done; if you haven't already done so, check the docker configuration section, then launch the test suite

Support plan

I plan to support the latest stable Debian release. When a new release comes out, I'll support the oldstable for a few months before dropping it.

Ubuntu (multiple releases)

There're repositories for various Ubuntu versions.

First, you should make sure that you've got Bintray's package signing key properly installed and configured for apt:

bash
curl https://www.franzoni.eu/keys/D401AB61.txt | sudo apt-key add -

And you should make sure the ```apt-transport-h

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ccentosdockerfedorapackaging

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理