Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

How to build .DEB packages through Docker

1 min read

Building .DEB package is still a daunting process. It involves a series of compiling, linking and building the source packages. Compiling tuns your source code into object code.Linking combines your object code with libraries into a raw executable whereas building is the sequence composed of compiling and linking, with possibly other tasks such as installer creation.

You start with setting up build process, linking the object code with libraries and then series of steps to build .DEB packages. It involves complexity and series of debugging to reach the end point of creating .DEB packages. Last week I started looking at making the developer’s work more easy. Why not use Docker?  Let me share how easy is it get .DEB packages built up. Here we go:

I picked up nagios as I have a pretty good understanding on Nagios tool.

My Dockerfile looked very similar to the below:


File: build.sh

The file build.sh helps you to build the container through Docker file. Hope this is placed under the parent nagios/ directory.


Once .deb is created through Dockerfile successfully, you might be interested to copy it to the host machine and henceafter removing the container. This file might help you with this.

File: extractdeb.sh


File: resource/configure.sh

The configure.sh provides all the necessary option for supplying the required parameter for nagios to pick and stay on the filesystem as shown below:


That’s it. Just run the below commands in sequence and you are ready to build .DEB package in a single shot:

#cd ajeetraina/nagios



Hope you enjoyed the post. Do reach out to me if you have further ideas and suggestions.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Docker Captain, ARM Innovator & Docker Bangalore Community Leader.

Leave a Reply

Your email address will not be published.