With the new release of Docker 0.11 it has finally become easy to run Asterisk inside of Docker. Instead of port forwarding your RDP and SIP ports, you can now pass –net=host to Docker and avoid all those NAT SIP header rewriting issues. My start_asterisk configuration is below and beneath that is a second command I use for accessing the Asterisk Shell.

$ docker run -d -v /opt/asterisk/voicemail:/var/spool/asterisk/voicemail -v \


  /opt/asterisk/monitor:/var/spool/asterisk/monitor -v /opt/asterisk/etc:/etc/asterisk -v \


  /opt/asterisk/run:/var/run/asterisk --net=host asterisk asterisk -v


$ docker run -i -v /opt/asterisk/run:/var/run/asterisk -t asterisk asterisk -rvvv

Before running the above commands, you need to build the docker image which is done by running ….

$ docker run -i -t ubuntu /bin/bash
# you're now in a docker instance  
$ apt-get -y install asterisk  
$ /etc/init.d/asterisk start  
$ netstat -nap | grep asterisk  
$ CTRL-P + CTRL-Q (this will return to your shell and keep the container running)

Save the Asterisk Docker image so you can run it.

$ docker commit -m "Asterisk with Apache" `docker ps -l -q` asterisk

I originally build the Asterisk Docker image from instructions at http://areskibelaid.com/asterisk-on-docker/ but these instructions supersede his if you are using SIP.

http://blog.docker.com/2014/05/docker-0-11-release-candidate-for-1-0/