Installing Asterisk inside a CentOS docker image on Xubuntu

I'm trying to install an Asterisk server inside a CentOS 6.5 docker image running on Xubuntu 14.04. I downloaded Dahdi from wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.4.1.2+2.4.1.tar.gz, but when I start to install it using make all, I get the following error:

bash-4.1# make all
make -C linux all
make[1]: Entering directory `/usr/src/dahdi-linux-complete-2.4.1.2+2.4.1/linux'
make -C drivers/dahdi/firmware firmware-loaders
make[2]: Entering directory `/usr/src/dahdi-linux-complete-2.4.1.2+2.4.1/linux/drivers/dahdi/firmware'
Attempting to download dahdi-fwload-vpmadt032-1.25.0.tar.gz
--2014-07-26 07:06:14--  http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fwload-vpmadt032-1.25.0.tar.gz
Resolving downloads.digium.com... 76.164.171.238, 2001:470:e0d4::ee
Connecting to downloads.digium.com|76.164.171.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 149360 (146K) [application/x-gzip]
Saving to: `dahdi-fwload-vpmadt032-1.25.0.tar.gz'

100%[==============================================================================================================================>] 149,360     88.4K/s   in 1.6s    

2014-07-26 07:06:17 (88.4 KB/s) - `dahdi-fwload-vpmadt032-1.25.0.tar.gz' saved [149360/149360]

make[2]: Leaving directory `/usr/src/dahdi-linux-complete-2.4.1.2+2.4.1/linux/drivers/dahdi/firmware'
You do not appear to have the sources for the 3.13.0-30-generic kernel installed.
make[1]: *** [modules] Error 1
make[1]: Leaving directory `/usr/src/dahdi-linux-complete-2.4.1.2+2.4.1/linux'
make: *** [all] Error 2

I don't understand why I'm getting error that I don't have headers for kernel 3.13.0-30 because when I run

apt-get install linux-headers-$(uname -r)

On Xubuntu, I get:

linux-headers-3.13.0-30-generic is already the newest version.

Solution 1:

You can compile it outside the container, and just do the make install part of the process inside. Or just set the right repository and install a package with the needed version of it.

Just 2 warnings, if anything requires I.e. loading kernel modules probably will require extra privileges to run inside a container (maybe the compiling process tried to check things of the kernel that you can't access from a simple container) and using SIP (a common requirement for asterisk) will require to enable more than a few ports when running it