Docker - camera processes crashing

Forum for questions and support relating to 1.33.x development only.
Locked
Daylights
Posts: 13
Joined: Tue Oct 02, 2018 11:24 am

Docker - camera processes crashing

Post by Daylights »

I used to run Zoneminder 1.30 locally installed on Ubuntu 16.04, 4 camera's. After I reinstalled the server with Ubuntu 18.04 I thought it would be a good idea to put every service in a docker container. I've managed to start a separate MariaDB container, with is working fine for other services. I've also started a separate container for Zoneminder, which is also perfectly accessible on http://<ip>:8000/zm. But no matter how or what camera I add, the zmc services start en crash almost instantly as a repeated process. I am using docker-compose for all my services and I chose for the quantumobject/docker-zoneminder, since it's more recently updated: https://hub.docker.com/r/quantumobject/ ... oneminder/

Code: Select all

version: '3.2'
services:
  zoneminder:
    image: quantumobject/docker-zoneminder
    container_name: zoneminder
    ports:
      - "8000:80"
    volumes:
      - "/data/containers/zoneminder/backups:/var/backups"
      - "/data/containers/zoneminder/cache:/var/cache/zoneminder"
    environment:
      - TZ=Europe/Amsterdam
      - VIRTUAL_HOST=zm.localhost, home.mydomain.nl, zm.mydomain.nl
      - SERVICE_PORTS="80"
      - ZM_DB_HOST=<ip address MariaDB>
      - ZM_DB_USER=zmuser
      - ZM_DB_PASS=zmpass
      - ZM_DB_NAME=zm
    restart: unless-stopped
I already provided chmod 777 (as a test) to the persistent mapped volumes on /data/containers/zoneminder. Currently I have 1 camera (id 5) enabled, the logs give me no clue:

Code: Select all

2019-02-11 09:39:07.014910 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:39:06.736800 zmdc[4322].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:39:06]
2019-02-11 09:39:06.736670 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:39:06, pid = 4322]
2019-02-11 09:39:06.729760 zmdc[230].WAR-zmdc.pl [Can't find process with command of 'zmc -m 5']
2019-02-11 09:39:06.584360 zmwatch[478].INF-zmwatch.pl [Restarting capture daemon for Woonkamer, shared data not valid]
2019-02-11 09:38:56.575680 zmdc[230].INF-zmdc.pl [Command 'zmc -m 5' removed from pending list at 19/02/11 09:38:56]
2019-02-11 09:38:56.425340 zmwatch[478].INF-zmwatch.pl [Restarting capture daemon for Woonkamer, shared data not valid]
2019-02-11 09:38:53.277980 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:38:53.008240 zmdc[4273].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:38:53]
2019-02-11 09:38:53.007380 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:38:53, pid = 4273]
2019-02-11 09:38:52.998630 zmdc[230].INF-zmdc.pl [Starting pending process, zmc -m 5]
2019-02-11 09:38:47.989920 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:38:47.712650 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:38:47, pid = 4271]
2019-02-11 09:38:47.712360 zmdc[4271].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:38:47]
2019-02-11 09:38:47.703240 zmdc[230].INF-zmdc.pl [Starting pending process, zmc -m 5]
2019-02-11 09:38:46.698630 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:38:46.406150 zmdc[4269].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:38:46]
2019-02-11 09:38:46.405680 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:38:46, pid = 4269]
2019-02-11 09:38:46.397170 zmdc[230].WAR-zmdc.pl [Can't find process with command of 'zmc -m 5']
2019-02-11 09:38:46.253640 zmwatch[478].INF-zmwatch.pl [Restarting capture daemon for Woonkamer, shared data not valid]
2019-02-11 09:38:36.245070 zmdc[230].INF-zmdc.pl [Command 'zmc -m 5' removed from pending list at 19/02/11 09:38:36]
2019-02-11 09:38:36.092720 zmwatch[478].INF-zmwatch.pl [Restarting capture daemon for Woonkamer, shared data not valid]
2019-02-11 09:38:32.883870 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:38:32.601170 zmdc[4263].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:38:32]
2019-02-11 09:38:32.601150 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:38:32, pid = 4263]
2019-02-11 09:38:32.590540 zmdc[230].INF-zmdc.pl [Starting pending process, zmc -m 5]
2019-02-11 09:38:27.650170 zmdc[230].INF-zmdc.pl ['zmc -m 5' crashed, signal 134]
2019-02-11 09:38:27.375510 zmdc[4259].INF-zmdc.pl ['zmc -m 5' started at 19/02/11 09:38:27]
2019-02-11 09:38:27.374970 zmdc[230].INF-zmdc.pl ['zmc -m 5' starting at 19/02/11 09:38:27, pid = 4259]
It feels like either the container cannot access the camera's IP, which would be strange. I already tried network_mode: host, still the same issue. Or a permission issue, or a memory issue?

Verbose logging gives me no real clue either, so I am out of ideas.
mfitch
Posts: 17
Joined: Mon Feb 11, 2019 5:23 pm

Re: Docker - camera processes crashing

Post by mfitch »

I had this problem also. The issue is that Docker limits the Shared Memory (shm) of its containers by default to 64M, which is far too low for zoneminder. The fix is to increase your shm allocation when you run your image:

Code: Select all

docker run --shm-size="224M" <image name>
https://docs.docker.com/engine/reference/run/

In the console view in zoneminder, keep an eye on your shared memory percentage to tweak how much you should be using.
Daylights
Posts: 13
Joined: Tue Oct 02, 2018 11:24 am

Re: Docker - camera processes crashing

Post by Daylights »

mfitch wrote: Mon Feb 11, 2019 5:29 pm I had this problem also. The issue is that Docker limits the Shared Memory (shm) of its containers by default to 64M, which is far too low for zoneminder. The fix is to increase your shm allocation when you run your image:

Code: Select all

docker run --shm-size="224M" <image name>
https://docs.docker.com/engine/reference/run/

In the console view in zoneminder, keep an eye on your shared memory percentage to tweak how much you should be using.
That was indeed it. Although after that, I cannot seem to get RTSP (remote) streams working like I did in version 1.30, but in 1.33 Ffmpeg streams with RTSP:// works fine :)
mfitch
Posts: 17
Joined: Mon Feb 11, 2019 5:23 pm

Re: Docker - camera processes crashing

Post by mfitch »

According to the 'Defining Monitors' readthedocs page (https://zoneminder.readthedocs.io/en/st ... nitor.html) for the 'remote' source type,

Code: Select all

If you camera does speak RTSP then you should change your source type to ffmpeg instead of selecting RTSP here.
The Remote -> RTSP method is no longer being maintained and may go away at some point in the future.
I think you're better off using the ffmpeg source type for RTSP anyway. Glad you got it working!
Locked