Install Asterisk Docker Image on Ubuntu 20.04
This post presents the instruction to install asterisk docker image on Ubuntu 20.04.
Install Docker
sudo apt -y update upgrade
sudo apt install -y net-tools docker.io
The rbsongcan/rbs-asterisk is a basic asterisk image, which will be used in this post. Following the below steps to have an asterisk server up and running just in few minutes.
docker run -d --network host --name rbs-asterisk rbsongcan/rbs-asterisk
The command will run the asterisk container and bind the IP and ports to docker host’s. And you can check asterisk binding IP and ports by:
netstat -lnp | grep asterisk
udp 0 0 0.0.0.0:4520 0.0.0.0:* 66351/asterisk
udp 0 0 0.0.0.0:4569 0.0.0.0:* 66351/asterisk
udp 0 0 0.0.0.0:5000 0.0.0.0:* 66351/asterisk
udp 0 0 0.0.0.0:5060 0.0.0.0:* 66351/asterisk
udp 0 0 0.0.0.0:50811 0.0.0.0:* 66351/asterisk
udp6 0 0 :::36790 :::* 66351/asterisk
unix 2 [ ACC ] STREAM LISTENING 255948 66351/asterisk /var/run/asterisk/asterisk.ctl
Practically, you need to modify data on asterisk then –mount docker parameter is require:
docker run -d --network host --name rbs-asterisk \
--mount source=rbs-asterisk,target=/etc/asterisk rbsongcan/rbs-asterisk
docker volume inspect rbs-asterisk
[
{
"CreatedAt": "2022-06-01T01:37:09Z",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/rbs-asterisk/_data",
"Name": "rbs-asterisk",
"Options": null,
"Scope": "local"
}
]
You can find asterisk configuration files at
/var/lib/docker/volumes/rbs-asterisk/_data
Finally, connect to asterisk console:
docker exec -it rbs-asterisk asterisk -r
Alternative
Another option that is the original post before rbs-asterisk docker image is developed.
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
service docker status
Download Asterisk Docker image
root@zabbix:/etc/docker# docker pull izdock/izpbx-asterisk
root@zabbix:/etc/docker# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
izdock/izpbx-asterisk latest 7370d4e0d5fe 2 weeks ago 1.56GB
(Some image require tag latest, default or a specific name, for ex: docker pull izdock/izpbx-asterisk:tag_name)
Run the containers:
Recommended:
git clone https://github.com/ugoviti/izdock-izpbx.git /opt/izpbx
cd /opt/izpbx
git checkout refs/tags/$(git tag | sort --version-sort | tail -1)
cp default.env .env
#Customize .env variables, specially the security section of default passwords (look bellow for a full variables list):
vim .env
docker-compose up -d
#Wait the pull to finish (~60 seconds with fast internet connections) and point your web browser to the IP address of your docker host and follow initial setup guide
More instruction:
https://hub.docker.com/r/izdock/izpbx-asterisk
Initial FreePBX Setup
http://_docer_host_ip:80/admin
To install and configure a dockerized FreeSwitch on Ubuntu 20 refer to this link:
https://rbsongcan.store/install-freeswitch-from-a-freeswitch-docker-image-fs-rbsongcan/