Customising zm on docker

Support for the docker image maintained by dlandon
Post Reply
kr17
Posts: 1
Joined: Thu Apr 30, 2020 5:58 pm

Customising zm on docker

Post by kr17 »

Firstly thanks for putting this docker image together.
I used ZM years ago, and want to set up again, and it makes sense for me to use docker rather than a VM this time around.

Before I do so, I wanted to have a bit of a play with it, to get a feel for how it worked, and also understand the backup, recovery and persistance of it all (volumes). I therefore a did a bit of a course on Udemy and played with docker a bit.

So, I've managed to get ZM running in docker. However, the first thing I noticed was that if I browsed to the server, I got the apache welcome page, and I need to specify /zm on the URL. This clearly isn't an issue, but I wanted to have a play and work out how I could customise the docker container by having a redirect to /zm on the default index page.

And this is where my knowledge falls apart, and I wonder if someone could help me get my head around it. I'm a bit confused as to the difference between the docker-compose and the Dockerfile, and where my customisations should go.

I've build my ZM using docker-compose up -d
I can see that this builds with image: dlandon/zoneminder:latest

I can also see the Dockerfile, which builds on phusions/baseimage, and does all the installing rpms, config etc.

So I've managed to build myself a new image using a copy of the dockerfile, where I copy a new index.html into place:
COPY index.html /var/www/html/index2.html
RUN cp /var/www/html/index2.html /var/www/html/index.html
and built it with:
docker build --tag mytest:1.0 .

Then run my new image with:
docker run -p 443:443 8b0b024529ae

And that seems to work, I get my overwritten index.html when I go to IPaddress:8443

But I cant work out how I would build this into docker-compose?
If I amend the image in docker-compose.yaml to point at my image:

services:
zoneminder:
container_name: zoneminder
# image: dlandon/zoneminder:latest
image: a36f30fa78ad

It starts up really quickly, but the URL doesn't work.
EDIT: just tried this and it seemed to work this time
It looks like maybe I wasn't giving it enough time to start up in the background.

Anyway, if anyone has read this far, what I'd really like to know is:
1. If I want to customise this zoneminder in any way, do I do it in the Dockerfile or in the docker-compose.yaml
2. If I want to make a simple change to the html index file, do I really need to have a whole new 1.7Gb docker image, can the small change not be appended onto the old image? Or applied afterwards?
3. I can see that you create docker volumes for persistent data (good), but I'm a bit unclear what happens to data when I build a new image. If as part of the Dockerfile I copy index.html over a the index file, would this re-copy this file into the volume, or is all of that skipped as it has been done previously?

Apologies for asking all of this. I realise your idea was to just have a one-liner and it work for all, but I know I will want to customise my setup a little, and I'm trying to get my head around where and how that customisation should be done. Hopefully this makes some sort of sense.

Thanks in advance.
User avatar
bkjaya1952
Posts: 282
Joined: Sat Aug 25, 2018 3:24 pm
Location: Sri Lanka

Re: Customising zm on docker

Post by bkjaya1952 »

The following link may be useful to solve your problem.

https://github.com/bkjaya2020/bkjaya195 ... er-mysql8-
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Customising zm on docker

Post by asker »

@bkjaya1962, this forum is only meant for the (now official) docker image built by dlandon. It is not a general docker discussion forum for ZM. Please feel free to post your efforts in the ZM 1.3x forums
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Post Reply