How to Build a Zoneminder Docker Image (with MSMTP) using a Dockerfile & push to Docker Hub , (Ubuntu 19.10)

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
User avatar
Posts: 34
Joined: Sat Aug 25, 2018 3:24 pm
Location: Sri Lanka

How to Build a Zoneminder Docker Image (with MSMTP) using a Dockerfile & push to Docker Hub , (Ubuntu 19.10)

Post by bkjaya1952 » Sat Dec 21, 2019 2:05 pm

In this tutorial ,we are going to use “Docker: Enterprise Container Platform” ( on Ubuntu 19.10.First
Installation of Docker on Ubuntu 19.10
On the Ubuntu terminal
sudo apt install
Then a zoneminder-docker image is built using a Dockerfile and
Dockerfile contains the scripts to install free open-source software Zoneminder and has necessary commands to start Zoneminder ,Apache and other services and to keep the docker container running.
I have used my own Dockerfile and prepared by Andrew Bauer
The scripts in the Docker file are as shown in the following figure:- 1
Figure:- 1 Scripts in the Dockerfile
For the purpose of building the zoneminder- docker image the files Dockerfile and are saved on the Documents folder of the computer as shown in the following figure:- 2.
figure:- 2 Dockerfile and marked in green color saved in the Documents folder

The Dockerfile and can be downloaded from this links


Building the Zoneminder-Docker image ( tagged as “yourzoneminder”)
Open the Ubuntu terminal
cd ~/Documentssudo docker build –tag=yourzoneminder . # Dockerfile
( The process will take about 10-15 minutes)
After the image building process is finished ,you find the image by runng
sudo docker images

For the purpose of identifying the image in the Docker Hub , you will have to tag it with an appropriate name .

In our case ,I have name as “bkjaya1952/docker-zoneminder:v1.32.3.”

sudo docker tag yourzoneminder bkjaya1952/docker-zoneminder:v1.32.3.
Then push the tagged image to the Docker Hub
sudo docker login
Note : first you will have to signup & open a Docker Hub account at
sudo docker push bkjaya1952/docker-zoneminder:v1.32.3.


Figure:- 3 Tagging and pushing the image to the Docker Hub

Now you can see my pushed image at ... zoneminder

Figure:- 4 Pushed image at the Docker Hub

The instructions to use the image has been entered at the Docker Hub, after the pushing is completed .

Usage of the pushed image bkjaya1952/docker-zoneminder

sudo docker create -t -p 8085:80 --shm-size=4096m -e TZ=Asia/Colombo --name myzm --privileged=true bkjaya1952/docker-zoneminder:v1.32.3.
Note :- use your timezone instead of "TZ=Asia/Colombo"
sudo docker start myzm
Configuring MSMTP for emailing zoneminder motion detection events

Make the following file in the home folder of your computer and copy in to the zm container that you have created by above mentioned commands
Open the Ubuntu terminal and run
sudo gedit msmtprc

# Set default values for all following accounts.
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log
# Gmail
account gmail
port 587
from youer gmail address
user youer gmail address
password your gmail password
# Set a default account
account default : gmail

Then copy the created msmtpru file to the folder /etc/ of the zm container as follows
sudo docker cp msmtprc myzm:/etc/msmtprc
Open http://localhost:8085/zm/ and add the camera monitors

And fill up email details under the Optons/email of the ZM-Panel
Create appropriate zm-filter to send email alerts of motion detection events
For entering e mail details and creating zm-filter please refer my following blog ( After the Figure:- 3 in the blog) ... ntu-19-10/
Figure:- 5 Received motion detection email alerts from Zoneminder

Acknowledgements : Based on Isaac Connor’s Zoneminder and Andrew Bauer’s entrypoint script
at ...

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests