Page 1 of 1

WORKING dockerized zoneminder connected to external database

Posted: Mon May 25, 2015 7:52 am
by cornbread
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

Re: WORKING dockerized zoneminder connected to external data

Posted: Mon May 25, 2015 2:04 pm
by knight-of-ni
Nice work. Docker is a great tool.

Re: WORKING dockerized zoneminder connected to external data

Posted: Tue Nov 03, 2015 1:27 am
by bdmartens
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!

Re: WORKING dockerized zoneminder connected to external data

Posted: Tue Nov 03, 2015 1:37 am
by bdmartens
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

Re: WORKING dockerized zoneminder connected to external data

Posted: Tue Nov 03, 2015 11:30 am
by patpend
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.

Re: WORKING dockerized zoneminder connected to external database

Posted: Wed Nov 04, 2015 3:20 am
by bdmartens
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

Re: WORKING dockerized zoneminder connected to external database

Posted: Wed Nov 04, 2015 11:25 am
by patpend
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.