toxuin / alarmserver

IP Camera Alarm Server to MQTT
MIT License
145 stars 34 forks source link

FTP requires host networking mode in docker #24

Open s7p opened 1 year ago

s7p commented 1 year ago

First of all, thanks a lot for creating this, this is awesome and is exactly what I needed.

I wasn't able to get alarmserver working using the Docker configs provided in README.md docker run -d -v $PWD/config.yml:/config.yml -v $PWD/ftp:/ftp -p 21:21 -p 15002:15002 toxuin/alarmserver

I can run alarmserver, and FTP can authenticate a user, but no files can be uploaded. It always produces error 425. I looked into this, and found that FTP will run in passive mode in containers and will open random ports for data exchange with client. So only mapping port 21 is not sufficient, the solution is to use host networking, map out a larger port range, or create a bridge.

Using host networking worked for me. Suggest adding a new command docker run -d -v $PWD/config.yml:/config.yml -v $PWD/ftp:/ftp --network host toxuin/alarmserver for others using the FTP method

shprota commented 1 year ago

Created PR #25 adding ability to override the passive mode public IP and port range. This allows to pass through the pre-defined range of ports when running the Docker container. Tested with my Hisilicon camera and it uploads the captured frames just fine now.