<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FreePBX 17 Docker Setup on Spoljarevic's Knowledgebase</title><link>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/</link><description>Recent content in FreePBX 17 Docker Setup on Spoljarevic's Knowledgebase</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sat, 15 Aug 2026 09:32:08 +0200</lastBuildDate><atom:link href="https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/index.xml" rel="self" type="application/rss+xml"/><item><title>Introduction</title><link>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Introduction/</guid><description>&lt;h2 id="what-is-freepbx"&gt;What is FreePBX?&#10;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://www.freepbx.org/"&gt;FreePBX&lt;/a&gt; is an open-source web GUI for &lt;a href="https://www.asterisk.org/"&gt;Asterisk&lt;/a&gt;, the&#10;PBX/VoIP engine that underpins it. Asterisk on its own is configured through plain-text dialplan files;&#10;FreePBX wraps it in a web interface for managing extensions, trunks, inbound/outbound routes, IVRs,&#10;voicemail, and the rest of what a phone system needs, without hand-editing Asterisk config. Version 17 is&#10;the current release line, built on Asterisk 22 and PHP 8.2.&lt;/p&gt;</description></item><item><title>Usage</title><link>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Usage/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Usage/</guid><description>&lt;h2 id="prerequisites"&gt;Prerequisites&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Docker and Docker Compose (&lt;code&gt;docker-compose&lt;/code&gt; or the &lt;code&gt;docker compose&lt;/code&gt; plugin) on the host.&lt;/li&gt;&#10;&lt;li&gt;A host willing to run a &lt;strong&gt;privileged&lt;/strong&gt; container — this setup needs &lt;code&gt;--privileged&lt;/code&gt; and an unconfined&#10;seccomp profile for systemd to manage services inside the container.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="1-clone-the-repository-and-build-the-image"&gt;1. Clone the repository and build the image&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-72d861c2-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="sh" data-td-line-count="3"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-72d861c2-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://codeberg.org/Spoljarevic/FreePBX-17-Container.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; FreePBX-17-Container&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo docker-compose build&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The build stage (see &lt;a href="https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Code-Explanation/"&gt;Code Explanation&lt;/a&gt;) only installs the OS-level prerequisites and&#10;copies in the install script — FreePBX itself is &lt;strong&gt;not&lt;/strong&gt; installed at build time.&lt;/p&gt;</description></item><item><title>Code Explanation</title><link>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Code-Explanation/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Code-Explanation/</guid><description>&lt;h2 id="dockerfile"&gt;&lt;code&gt;Dockerfile&lt;/code&gt;&#10;&lt;/h2&gt;&#10;&lt;div class="td-code td-code--untitled" id="td-code-d22fed7b-fence-0" data-td-code data-td-code-auto-id&#10; data-td-language="dockerfile" data-td-line-count="12"&gt;&#10; &lt;div class="td-code__viewport" id="td-code-d22fed7b-fence-0-viewport" data-td-code-viewport&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-dockerfile" data-lang="dockerfile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;debian:bookworm&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;...&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get install -y &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; wget curl gnupg2 sudo git vim ca-certificates lsb-release software-properties-common &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; systemd systemd-sysv dbus net-tools openssh-client &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; apt-get clean&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;/usr/src&lt;/span&gt;&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;COPY&lt;/span&gt; sng_freepbx_debian_install.sh .&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; chmod +x ./sng_freepbx_debian_install.sh&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;RUN&lt;/span&gt; ln -s /var/lib/asterisk/bin/fwconsole /usr/sbin/fwconsole &lt;span class="o"&gt;||&lt;/span&gt; true&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;80&lt;/span&gt; &lt;span class="m"&gt;443&lt;/span&gt; 5060/udp 5160/udp 18000-18100/udp&lt;span class="err"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/bin/bash&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The image is deliberately thin:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Base&lt;/strong&gt;: &lt;code&gt;debian:bookworm&lt;/code&gt; — Sangoma&amp;rsquo;s install script hard-codes support for Debian 12 only (it checks&#10;&lt;code&gt;VERSION_CODENAME&lt;/code&gt;/&lt;code&gt;/etc/debian_version&lt;/code&gt; and exits if it isn&amp;rsquo;t &lt;code&gt;bookworm&lt;/code&gt;).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Installed at build time&lt;/strong&gt;: only &lt;code&gt;systemd&lt;/code&gt;/&lt;code&gt;systemd-sysv&lt;/code&gt;/&lt;code&gt;dbus&lt;/code&gt; (so the container can boot like a real&#10;init system) plus generic tooling the install script or an admin would want (&lt;code&gt;wget&lt;/code&gt;, &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;vim&lt;/code&gt;,&#10;etc). FreePBX, Asterisk, MariaDB, Apache, and PHP are &lt;strong&gt;not&lt;/strong&gt; installed here — that all happens later, at&#10;container &lt;em&gt;runtime&lt;/em&gt;, by running the copied-in script manually.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;The &lt;code&gt;fwconsole&lt;/code&gt; symlink&lt;/strong&gt;: &lt;code&gt;fwconsole&lt;/code&gt; is FreePBX&amp;rsquo;s CLI (module management, restarts, etc). The install&#10;script normally expects it at a path that isn&amp;rsquo;t always on &lt;code&gt;PATH&lt;/code&gt; yet immediately after install in a fresh&#10;container; the symlink into &lt;code&gt;/usr/sbin&lt;/code&gt; pre-empts that so &lt;code&gt;fwconsole&lt;/code&gt; works without extra steps once&#10;FreePBX is installed. The &lt;code&gt;|| true&lt;/code&gt; makes the build tolerant of the target not existing yet at build time.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;CMD [&amp;quot;/bin/bash&amp;quot;]&lt;/code&gt;&lt;/strong&gt;: the image&amp;rsquo;s default command is just a shell — the actual PID 1 process is&#10;overridden by &lt;code&gt;docker-compose.yml&lt;/code&gt;&amp;rsquo;s &lt;code&gt;command: [&amp;quot;/sbin/init&amp;quot;]&lt;/code&gt;, not this line.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Installing FreePBX at &lt;em&gt;build&lt;/em&gt; time isn&amp;rsquo;t possible here: the installer needs a running init system managing&#10;services (&lt;code&gt;systemctl&lt;/code&gt;), which only exists once the container is actually started, not while &lt;code&gt;docker build&lt;/code&gt;&#10;is assembling image layers.&lt;/p&gt;</description></item><item><title>FAQ</title><link>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/FAQ/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/FAQ/</guid><description>&lt;h3 id="why-does-the-container-need-privileged-true"&gt;Why does the container need &lt;code&gt;privileged: true&lt;/code&gt;?&#10;&lt;/h3&gt;&#10;&lt;p&gt;Because it runs &lt;code&gt;systemd&lt;/code&gt; as PID 1, and systemd needs privileges Docker doesn&amp;rsquo;t grant by default (managing&#10;cgroups, mounting filesystems, controlling devices) to supervise the services FreePBX depends on — Apache,&#10;MariaDB, Asterisk. Without it, &lt;code&gt;/sbin/init&lt;/code&gt; won&amp;rsquo;t boot cleanly inside the container. See&#10;&lt;a href="https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Introduction/"&gt;Introduction&lt;/a&gt; for the trade-off this implies.&lt;/p&gt;&#10;&lt;h3 id="why-isnt-freepbx-installed-automatically-when-i-build-the-image"&gt;Why isn&amp;rsquo;t FreePBX installed automatically when I build the image?&#10;&lt;/h3&gt;&#10;&lt;p&gt;Sangoma&amp;rsquo;s install script assumes it&amp;rsquo;s running on an already-booted system with a working init system&#10;managing services — that&amp;rsquo;s only true once the container is actually &lt;em&gt;running&lt;/em&gt;, not while &lt;code&gt;docker build&lt;/code&gt; is&#10;assembling layers. So the build stage only prepares the environment (Debian + systemd + the script itself);&#10;you run the installer yourself after &lt;code&gt;docker-compose up -d&lt;/code&gt;. See &lt;a href="https://kb-migration.spoljarevic.sh/Big-Projects/FreePBX-17-Docker-Setup/Usage/"&gt;Usage&lt;/a&gt; for the exact steps.&lt;/p&gt;</description></item></channel></rss>