Run on Docker?

Hello,
is it a good idea to use Freepbx in a docker?

I have install it from this

[הקלידו או הדביקו קוד כאן](https://hub.docker.com/r/flaviostutz/freepbx)

and the server is up after running this command :

docker run -d -p 80:80 -p 443:443 -p 4445:4445 -p 4569:4569 -p 5060:5060 -p 5160:5160 -p 8001:8001 -p 8003:8003 -p 8008:8008 -p 8009:8009 --name test1 tiredofit/freepbx

but I can’t connect to server with my sip phone

then I saw I can make a yml file with all the setting
so I have create a file called docker-compose.yml

version: '3.3'
services:
  freepbx:
    image: flaviostutz/freepbx
    ports:
      - 80:80
      - 5060:5060/udp
      - 5160:5160/udp
      - 3306:3306
      - 18000-18100:18000-18100/udp
    restart: always
    environment:
      - ADMIN_PASSWORD=admin123
    volumes:
      - backup:/backup
      - recordings:/var/spool/asterisk/monitor

volumes:
  backup:
  recordings:

then I saw I need to run

docker-compose up -d

but now it won’t start

docker-compose up
Starting ubuntu_freepbx_1 ... done
Attaching to ubuntu_freepbx_1
freepbx_1  | iptables v1.8.2 (legacy): can't initialize iptables table `filter': Permission denied (you must be root)
freepbx_1  | Perhaps iptables or your kernel needs to be upgraded.
freepbx_1  | For enabling fail2ban you have to run this container with 'privileged: true'


  1. what did I do wrong while running the yml file?
  2. what am I missing in the ports ?
  3. is it a good idea to run FreePBX on docker?

Thanks,

I wouldn’t, but add this to your yaml file and try again just for the sake of argument: privileged: true

I will
but how do the docker “know” to use this ymal file ?
what if I have created 2 files?
** asking to understand

Thansk,

^^^ the errors often tell you what the error is.

Neither FreePBX or Asterisk are designed with Dockers/Containers in mind. Can it be done? Sure. Is it going to be supported or recommended? Not really. Will there be issues that will be related to this? Oh yes, there will be.

OK
good to know

Thank you for the asnwers

When you’re in the directory in which the yaml file is and you run “docker-compose up -d” it automatically does everything for you. The file is called “Dockerfile” and there can be only one file in the directory.