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

From ZoneMinder Wiki
Jump to navigationJump to search



If you grabbed this image prior to 6-18-15 I suggest you repull it to have it work properly with the following command, otherwise continue with the real introduction

docker pull hrwebasst/docker-zoneminder

Real 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=my-secret-pass --name=zm-mysql mysql
sudo docker run -d --name=zoneminder --link=zm-mysql:mysql -p 443:443 --privileged=true hrwebasst/docker-zoneminder

How hard was that? Now you can browse to https://SERVER/zm Notice that we don't need to give the zoneminder docker any information as the ENV vars are passed to it through the link.

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 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


If you get something like: FATA[0000] Error response from daemon: Conflict, The name zoneminder is already assigned to 0eb19f019a4f it means that your for some reason stopped your docker container and can't reuse the name "zoneminder" to run another container. if this is the case then you should be able to just run "docker start zoneminder" and have it start back up. If for some reason it's broken and not starting you can run the following.

docker rm zoneminder
docker pull hrwebasst/docker-zoneminder:latest

and then rerun the above run command for zoneminder