ZM in docker with docker-compose

Forum for questions and support relating to the 1.31.x releases only.
Locked
nic0
Posts: 3
Joined: Thu Oct 05, 2017 8:49 pm

ZM in docker with docker-compose

Post by nic0 »

Hi,

i just want to share my setup with working docker from linuxserver.
if this post is not allowed then please delete it - here it goes.

i want to run my ZM in docker, as i do with a lot of other application, most of them are from linuxserver.
for handling all my container, with updated/change settings and updates i use docker-compose

its pretty simple, start with getting a clone of zoneminder from linuxserver on github in the wanted folder you want it to be handled
git clone https://github.com/linuxserver/docker-zoneminder.git
edit root/etc/cont-init.d/30-config and change the timezone

Code: Select all

# set php timezone
PHP_TZ=${PHP_TZ:-Europe/Copenhagen}
save and exit.
now return to the folder where the Dockerfile is located create a file called docker-compose.yml and edit it and paste this in, with your edit needs

Code: Select all

version: '3'

services:
  zoneminder:
    build: .
    container_name: zoneminder_ioserver
    restart: always
    ports:
      - 8000:80 #change the first port to where you want it
    environment:
      - PGID=1001
      - PUID=1001
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - /path/for/your/image/video/saving:/data #change for where you want all capture file to be stored
    shm_size: 4096M #edit it for fit your memory needs normally half of your totally memory
im not a shark with linux, but this work perfect for me, and my data path is pointing at my nas server.

/nic0
Last edited by nic0 on Mon Oct 09, 2017 7:16 pm, edited 1 time in total.
erthtek
Posts: 1
Joined: Fri Oct 06, 2017 10:49 pm

Re: ZM in docker with docker-compose

Post by erthtek »

Greetings, when i tried to run this docker-compse it was telling me that version"3" was incorrect. so i changed it to version "2" and its pulling fine?
Any ideas why and the difference?
Thanks in advance
nic0
Posts: 3
Joined: Thu Oct 05, 2017 8:49 pm

Re: ZM in docker with docker-compose

Post by nic0 »

Happy to hear it works for you :)
From version 2 to 3 they added and remove sim features and some codes stop worked :) but you didn’t ran into any of them. What I could be worried about is the shm size have changed in you’re Docker container. Try to “Docker exec -I -t <containterid> bash” the is can you see by typing “Docker ps” type “df-h”

Here you can read more about Docker version 2 and 3 differently
https://docs.docker.com/compose/compose ... ersioning/

I ran into some Timezone problem when storing my video/image. I think i got it fixed. I’ll post and update of my Docker-compose later :)
michaelarnauts
Posts: 1
Joined: Sun Nov 12, 2017 10:58 am

Re: ZM in docker with docker-compose

Post by michaelarnauts »

I'm using this docker-compose file. You don't need to rebuild it manually since you can use ENV-variables to define the timezones.

This is basically the same as the topic starter his config, but I also configured TZ and PHP_TZ to my timezone. I also think 4GB of shared memory for zoneminder is a lot. For two HD camera's, I've seen 512MB to be enough.

Code: Select all

version: "3"

services:
  zoneminder:
    container_name: zoneminder
    image: linuxserver/zoneminder
    ports:
    - "8081:80"
    volumes:
    - /etc/localtime:/etc/localtime:ro
    - ./config:/config
    - ./data:/data
    environment:
    - TZ=Europe/Brussels
    - PHP_TZ=Europe/Brussels
    - PUID=1000
    - GUID=1000
    shm_size: 512M
    restart: unless-stopped
nic0
Posts: 3
Joined: Thu Oct 05, 2017 8:49 pm

Re: ZM in docker with docker-compose

Post by nic0 »

michaelarnauts wrote: Sun Nov 12, 2017 11:02 am I'm using this docker-compose file. You don't need to rebuild it manually since you can use ENV-variables to define the timezones.

This is basically the same as the topic starter his config, but I also configured TZ and PHP_TZ to my timezone. I also think 4GB of shared memory for zoneminder is a lot. For two HD camera's, I've seen 512MB to be enough.
the reason i added so much memory was that i want alot of og Pre- Post events from the recording and that means "use" more memory, beside that i want it in 1080 with OK framerate :)
but yeah turn it down after your need.

glad its any use for you guys.

cheers
4integration
Posts: 1
Joined: Fri Jul 06, 2018 8:20 pm

Re: ZM in docker with docker-compose

Post by 4integration »

Hi,

I have been running Zoneminder in Docker for a while but was required to re-install my server.

Running the same docker compose but getting issues.

The docker-compose

Code: Select all

version: "2"

services:
  zoneminder:
    container_name: zoneminder
    image: linuxserver/zoneminder
    ports:
        - "8888:80"
    volumes:
        - /etc/localtime:/etc/localtime:ro
        - /data/disk1/zoneminder/config:/config
        - /data/disk1/zoneminder/data:/data
    environment:
        - TZ=Europe/Stockholm
        - PHP_TZ=Europe/Stockholm
    shm_size: 1024M
    restart: always
Output:

Code: Select all

[joacim@thor zoneminder]$ sudo docker-compose up
[sudo] password for joacim:
Creating zoneminder
Attaching to zoneminder
zoneminder    | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
zoneminder    | [s6-init] ensuring user provided files have correct perms...exited 0.
zoneminder    | [fix-attrs.d] applying ownership & permissions fixes...
zoneminder    | [fix-attrs.d] done.
zoneminder    | [cont-init.d] executing container initialization scripts...
zoneminder    | [cont-init.d] 10-adduser: executing...
zoneminder    | usermod: no changes
zoneminder    |
zoneminder    | -------------------------------------
zoneminder    |           _         ()
zoneminder    |          | |  ___   _    __
zoneminder    |          | | / __| | |  /  \
zoneminder    |          | | \__ \ | | | () |
zoneminder    |          |_| |___/ |_|  \__/
zoneminder    |
zoneminder    |
zoneminder    | Brought to you by linuxserver.io
zoneminder    | We gratefully accept donations at:
zoneminder    | https://www.linuxserver.io/donations/
zoneminder    | -------------------------------------
zoneminder    | GID/UID
zoneminder    | -------------------------------------
zoneminder    |
zoneminder    | User uid:    911
zoneminder    | User gid:    911
zoneminder    | -------------------------------------
zoneminder    |
zoneminder    | [cont-init.d] 10-adduser: exited 0.
zoneminder    | [cont-init.d] 30-config: executing...
zoneminder    | changed group of '/etc/zm/zm.conf' from root to abc
zoneminder    | [cont-init.d] 30-config: exited 0.
zoneminder    | [cont-init.d] 40-initialise-db: executing...
zoneminder    | [cont-init.d] 40-initialise-db: exited 0.
zoneminder    | [cont-init.d] done.
zoneminder    | [services.d] starting services
zoneminder    | [services.d] done.
zoneminder    | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message
zoneminder    | 180706 22:23:49 mysqld_safe Logging to syslog.
zoneminder    | 180706 22:23:49 mysqld_safe Starting mysqld daemon with databases from /data/database
zoneminder    | cat: /var/run/zoneminder/zm.pid: No such file or directory
zoneminder    | tail: invalid PID: ‘’
zoneminder    | cat: /var/run/zoneminder/zm.pid: No such file or directory
zoneminder    | tail: invalid PID: ‘’
zoneminder    | cat: /var/run/zoneminder/zm.pid: No such file or directory
zoneminder    | tail: invalid PID: ‘’
zoneminder    | cat: /var/run/zoneminder/zm.pid: No such file or directory
zoneminder    | tail: invalid PID: ‘’
zoneminder    | cat: /var/run/zoneminder/zm.pid: No such file or directory
Any ideas?
Locked