WORKING dockerized zoneminder connected to external database

Forum for questions and support relating to the 1.28.x releases only.
Post Reply
cornbread
Posts: 14
Joined: Wed May 08, 2013 12:44 am

WORKING dockerized zoneminder connected to external database

Post by cornbread » Mon May 25, 2015 7:52 am

Github repository is here:
https://github.com/hrwebasst/docker-zoneminder

With two commands you can now have zoneminder connected to an external database in a separate docker. Full readme is on my github repo.

sudo docker run -d -e MYSQL_ROOT_PASSWORD=uberpass -e MYSQL_DATABASE=zm -e MYSQL_USER=zm -e MYSQL_PASSWORD=uberpass --name=mysql mysql
sudo docker run -d --name=zoneminder --link=mysql:mysql -p 443:443 --privileged=true -e DB_HOST=mysql -e DB_USER=zm -e DB_NAME=zm -e DB_PASS=uberpass hrwebasst/docker-zoneminder
Last edited by cornbread on Thu Jun 18, 2015 4:40 am, edited 2 times in total.

User avatar
knight-of-ni
Posts: 2229
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: WORKING dockerized zoneminder connected to external data

Post by knight-of-ni » Mon May 25, 2015 2:04 pm

Nice work. Docker is a great tool.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/

bdmartens
Posts: 7
Joined: Thu Sep 17, 2015 12:12 am

Re: WORKING dockerized zoneminder connected to external data

Post by bdmartens » Tue Nov 03, 2015 1:27 am

I think this is a great approach - after having spend hours and hours configuring zoneminder over the past decade with various hardware setups, it was rediculously easy to set it up freshly on a new system.

Unfortunately, it only really worked for an hour or so. I previously had zoneminder running on a non ssl server, and noticed that the https path was giving some of my devices some grief. Given that I didn't see how to easily change it (& SSL likely being a better choice anyway), I made a self-signed certificate, restarted the computer, and zoneminder would no longer start under docker.

I can't recall the specific error I had gotten at this time.

I tried manually starting the service in docker, and the container was already in use (but not accessible). Following the zoneminder wiki tips, I ran:
docker rm zoneminder
docker pull hrwebasst/docker-zoneminder:latest

but trying to start zoneminder gave the error that the container was empty.

running docker rm zoneminder, then repeating the second of the two initial (install in 2 steps) command gave the error that port 443 was already bound.

I'm assuming that a lot if this is due to me having never used docker before, but am having a difficult time sorting it out.

docker ps -l shows there being no containers at all, even after running the docker pull command.

Any suggestions?

Thanks!

bdmartens
Posts: 7
Joined: Thu Sep 17, 2015 12:12 am

Re: WORKING dockerized zoneminder connected to external data

Post by bdmartens » Tue Nov 03, 2015 1:37 am

FYI, given that the commands in the wiki (that I had used in this case) are different from the ones posted at the top of this thread, here are the commands I had used, with passwords removed:

sudo docker run -d -e MYSQL_ROOT_PASSWORD=[rootmysqlpassword] -e MYSQL_DATABASE=zm -e MYSQL_USER=zm -e MYSQL_PASSWORD=[zmmysqlpassword] --name=zm-mysql mysql

sudo docker run -d --name=zoneminder --link=zm-mysql:mysql -p 443:443 --privileged=true hrwebasst/docker-zoneminder

patpend
Posts: 43
Joined: Thu Mar 13, 2014 12:23 pm

Re: WORKING dockerized zoneminder connected to external data

Post by patpend » Tue Nov 03, 2015 11:30 am

I've been using QuantumObject/docker-zoneminder with success. I link the events and images folders to a directory located outside the container, on a dedicated large hard drive.

Code: Select all

sudo docker run -d --name="Zoneminder" --privileged=true -v /mnt/share/zoneminder/events:/var/cache/zoneminder/events:rw -v /mnt/share/zoneminder/images:/var/cache/zoneminder/images:rw -v /etc/localtime:/etc/localtime:ro -p 80:80 quantumobject/docker-zoneminder
Make sure you use the latest version of Docker, which will support the exec command, so you can fix the mysql issue in .107 like this:

Code: Select all

sudo docker exec -it Zoneminder bash
mysql -uroot -pmysqlpsswd
use zm;
CREATE INDEX `EventId_idx` ON `Frames` (`EventId`);
Hope this helps.

bdmartens
Posts: 7
Joined: Thu Sep 17, 2015 12:12 am

Re: WORKING dockerized zoneminder connected to external database

Post by bdmartens » Wed Nov 04, 2015 3:20 am

Same error, different port.


Error response from daemon: Cannot start container 21a70cbc71cfa55e34c7f79a9278805aae2dce52fb5eb6fd8d03c46300c1f307: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

This time it is more understandable, as I do have an apache2 server running on port 80

With regards to the previous error with port 443, I don't believe anything else on my system had been running on 443. I did have zoneminder up and running on 443 subsequently, until I tried to restart it after adjusting some ssl settings. Subsequently 443 was already bound.
I removed all my images and containers in docker, having learned the commands (listed for other newbies' benefit)
docker ps - display containers
docker rm [container name]
docker images
docker rmi [image name]

and for some of those, I needed to stop the container first, or run with -f to force it.

Regardless, when I tried to reinstall the container, the images had to re-download (as expected), but the port 443 was still occupied.

Does docker need a port all to itself? Is it not able to play nicely with apache port 80 or https port 443 services already running on the server? Do I then need to just make up my own port number for this to run on?

Any further insight?

Thanks

patpend
Posts: 43
Joined: Thu Mar 13, 2014 12:23 pm

Re: WORKING dockerized zoneminder connected to external database

Post by patpend » Wed Nov 04, 2015 11:25 am

Try port 8000 or 8080, or leave it as default and Docker will assign something for you, like port 49153.

Also try googling "linux what's using port" and see what is going on with your system.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests