Ajeet Raina I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Docker as a full-time employee. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

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:

Docker_DEB

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.

Docker_DEB2

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

Dock_1

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:

Docker_DEB4

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

#./build.sh

#./extractdeb.sh

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 I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Docker as a full-time employee. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

What is a Dockerfile – A Step-By-Step Guide

A Dockerfile is a text file which contains a series of commands or instructions. These instructions are executed in the order in which they...
Ajeet Raina
21 min read

Docker Desktop for Linux,  Docker Extensions and more with…

Docker Desktop 4.8.2 is now available for download for Mac, Windows and Linux. Here are the major highlights: Docker Desktop for various Linux distributions made available for the first...
Ajeet Raina
1 min read

Leave a Reply