Zoneminder 1.29 on Docker and Raspberry Pi 3
Posted: Sat May 14, 2016 8:39 pm
Hi,
I'm trying to run Zoneminder inside a docker container on a raspberry pi.
On the host I run a raspbian (jessie) and installed docker with the tutorial here: http://blog.hypriot.com/post/your-numbe ... ker-on-arm
I already created a Docker image with help from the aptalca docker image (https://github.com/aptalca/docker-zonem ... /README.md) and the installation instructions for raspbian (https://wiki.zoneminder.com/Raspbian). The Dockerfile looks like this currently:
I slightly modified the runfirst.sh from the aptalca image (https://github.com/aptalca/docker-zonem ... irstrun.sh) into firstrun.sh that now is:
And this is what my supervisord.conf file looks like so:
OK. This is all still in development and there is still much room for improvement. If you have any suggestions, let me know.
However, my problem is that I can't stream any video. I tried both a local and a remote video camera. They are both working fine if I install zoneminder directly on the raspbian host. If I add them with the exact same configuration to my docker zoneminder instance they are not working. I do not receive any error messages in the log. In fact I get serveral messages "Monitor-3: 6000 - Capturing at 20.00 fps" or "HTC: 1000 - Capturing at 9.71 fps".
But the montage view or the single view for the cameras simply not showing any image.
Does anybody have an idea how to fix that or where it comes from? Might it be releated to the docker source image "resin/rpi-raspbian" I'm using? I realized that it is quite light weight as it does not even contain a text editor. Maybe it's also missing other very fundamental stuff that is resulting in this error?
Any help is appreciated. Thank you
I'm trying to run Zoneminder inside a docker container on a raspberry pi.
On the host I run a raspbian (jessie) and installed docker with the tutorial here: http://blog.hypriot.com/post/your-numbe ... ker-on-arm
I already created a Docker image with help from the aptalca docker image (https://github.com/aptalca/docker-zonem ... /README.md) and the installation instructions for raspbian (https://wiki.zoneminder.com/Raspbian). The Dockerfile looks like this currently:
Code: Select all
FROM resin/rpi-raspbian:latest
EXPOSE 80
VOLUME ["/config"]
RUN apt-get update && \
apt-get upgrade; \
RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list; \
echo "Package: * \nPin: origin http.debian.net \nPin-Priority: 1001\n"\ > /etc/apt/preferences.d/zoneminder; \
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553; \
gpg -a --export 8B48AD6246925553 | sudo apt-key add -; \
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010; \
gpg -a --export 7638D0442B90D010 | apt-key add -; \
cat /etc/apt/preferences.d/zoneminder; \
apt-get update && \
apt-get install -y php5 mysql-server php-pear php5-mysql; \
apt-get install -y zoneminder; \
apt-get install -y libvlc-dev libvlccore-dev vlc;
RUN service mysql restart && \
service apache2 restart && \
mysql -uroot < /usr/share/zoneminder/db/zm_create.sql && \
mysql -uroot -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';" && \
chmod 740 /etc/zm/zm.conf && \
chown root:www-data /etc/zm/zm.conf;
RUN sudo ln -s /etc/zm/apache.conf /etc/apache2/conf-available/zoneminder.conf && \
a2enconf zoneminder && \
a2enmod rewrite && \
a2enmod cgi;
RUN chown -R www-data:www-data /usr/share/zoneminder/ && \
sed -i 's/\;date.timezone =/date.timezone = \"Europe\/Berlin\"/' /etc/php5/apache2/php.ini && \
service apache2 restart && \
service mysql restart && \
rm -r /etc/init.d/zoneminder && \
mkdir -p /etc/my_init.d;
COPY zoneminder /etc/init.d/zoneminder
COPY firstrun.sh /etc/my_init.d/firstrun.sh
COPY cambozola.jar /usr/share/zoneminder/www/cambozola.jar
RUN chmod +x /etc/init.d/zoneminder && \
chmod +x /etc/my_init.d/firstrun.sh && \
adduser www-data video && \
service apache2 restart && \
update-rc.d -f apache2 remove && \
update-rc.d -f mysql remove && \
update-rc.d -f zoneminder remove;
### raspbian image does not provid init.d or systemctl therefore we need something else
RUN apt-get install -y supervisor
COPY ./runfirst.sh /etc/
RUN chmod +x /etc/runfirst.sh
COPY ./supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]
Code: Select all
#!/bin/bash
#Search for config files, if they don't exist, copy the default ones
if [ ! -f /config/php.ini ]; then
echo "copying php.ini"
cp /etc/php5/apache2/php.ini /config/php.ini
else
echo "php.ini already exists"
cp /config/php.ini /etc/php5/apache2/php.ini
fi
# Copy mysql database if it doesn't exit
if [ ! -d /config/mysql/mysql ]; then
echo "moving mysql to config folder"
rm -r /config/mysql
cp -p -R /var/lib/mysql /config/
else
echo "using existing mysql database"
fi
# Copy data folder if it doesn't exist
if [ ! -d /config/data ]; then
echo "moving data folder to config folder"
mkdir /config/data
mkdir /config/data/images
mkdir /config/data/events
mkdir /config/data/temp
else
echo "using existing data directory"
fi
if [ ! -d /config/perl5 ]; then
echo "moving perl data folder to config folder"
mkdir /config/perl5
cp -R -p /usr/share/perl5/ZoneMinder /config/perl5/
else
echo "using existing perl data directory"
fi
echo "creating symbolink links"
rm -r /usr/share/zoneminder/www/events
rm -r /usr/share/zoneminder/www/images
rm -r /usr/share/zoneminder/www/temp
rm -r /var/lib/mysql
rm -r /usr/share/perl5/ZoneMinder
ln -s /config/data/events /usr/share/zoneminder/www/events
ln -s /config/data/images /usr/share/zoneminder/www/images
ln -s /config/data/temp /usr/share/zoneminder/www/temp
ln -s /config/mysql /var/lib/mysql
ln -s /config/perl5/ZoneMinder /usr/share/perl5/ZoneMinder
chown -R mysql:mysql /var/lib/mysql
chown -R www-data:www-data /config/data
chmod -R go+rw /config
#Get docker env timezone and set system timezone
echo "setting the correct local time"
echo $TZ > /etc/timezone
export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive
dpkg-reconfigure tzdata
#fix memory issue
echo "increasing shared memory"
umount /dev/shm
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=${MEM:-4096M} tmpfs /dev/shm
Code: Select all
[supervisord]
nodaemon=true
[program:runfirst]
command=/bin/bash -c "/etc/runfirst.sh"
[program:mysql]
command=service mysql start
[program:apache2]
command=service apache2 start
[program:zoneminder]
command=service zoneminder start
However, my problem is that I can't stream any video. I tried both a local and a remote video camera. They are both working fine if I install zoneminder directly on the raspbian host. If I add them with the exact same configuration to my docker zoneminder instance they are not working. I do not receive any error messages in the log. In fact I get serveral messages "Monitor-3: 6000 - Capturing at 20.00 fps" or "HTC: 1000 - Capturing at 9.71 fps".
But the montage view or the single view for the cameras simply not showing any image.
Does anybody have an idea how to fix that or where it comes from? Might it be releated to the docker source image "resin/rpi-raspbian" I'm using? I realized that it is quite light weight as it does not even contain a text editor. Maybe it's also missing other very fundamental stuff that is resulting in this error?
Any help is appreciated. Thank you