Ubuntu Any Version 12.04+ 64-bit with Zoneminder 1.28.1 the Docker way (two commands)

From ZoneMinder Wiki
Revision as of 17:30, 9 June 2015 by Corn13read (talk | contribs) (Created page with "= Introduction = Docker is amazing, with this you will set up two different "containers" (you can think of these as chroots on steroids or VMs without the VM ;) ) So why doc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Introduction

Docker is amazing, with this you will set up two different "containers" (you can think of these as chroots on steroids or VMs without the VM ;) )

So why docker? Well did you want to deal with dependency issues or weird setup problems? Or did you want to deploy without an internet connection, or possibly download an exact working image at work/home then deploy off-site without internet? No problem

Install Docker

You can get full instructions here or this command should work for you.

wget -qO- https://get.docker.com/ | sh

Quick and dirty ZM 1.28.x install

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

How hard was that? Now you can browse to https://SERVER/zm

Advanced information

In those above two commands the Environment Vars with the '-e' flag are creating database and connecting with those so you can modify them to your hearts content before running the commands.

Here is how I run the servers:

sudo docker run -d --restart=always --name=mysql -v /var/local/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=uberpass -e MYSQL_DATABASE=zm -e MYSQL_USER=zm -e MYSQL_PASSWORD=uberpass mysql
sudo docker run -d --restart=always --name=zoneminder -v /var/local/zm/images:/usr/share/zoneminder/images -v /var/local/zm/events:/usr/share/zoneminder/events --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

We've now passed a few folders into the containers and told them to always restart. The -v flags pass in local directories to destination folders in the containers. We are also telling them to always restart.

If you want to take the containers with you to do remote deploys you can. This gives you a tar of the entire container as created and you can deploy it without internet access on a machine with Docker installed. This is also handy for very slow internet connections.

docker pull mysql
docker pull hrwebasst/docker-zoneminder
docker export mysql > mysql.tar.gz && docker export hrwebasst/docker-zoneminder > zoneminder.tar.gz

then you can import them with:

cat mysql.tar.gz | sudo docker import - mysql
cat zoneminder.tar.gz | sudo docker import - zoneminder