ZM with Docker : Change Video Storage Volume

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
ccody73
Posts: 3
Joined: Sun Aug 11, 2019 9:28 pm

ZM with Docker : Change Video Storage Volume

Post by ccody73 » Sun Aug 11, 2019 9:48 pm

Hello.
I am sorry if this has been asked repeatedly, but I cannot find anything posted in the forums.
What I have is:
ZoneMinder 1.32.3
which resides in a Docker container for Version 19.03.1, build 74b1e89
All of this running on a CentOS Linux release 7.6.1810 box
(I don't think that motherboard or CPU enter into this.

I have Zoneminder installed on a single drive and the Docker install set everything up nicely (yeah zm community!)
It is my understanding that there is a Docker Volume for /var/cache/zoneminder (the default location, Lots of GUID characters in the actual file name.
What I want to do is to redirect the Docker Volume so that I can store all of the camera data/event data/etc. to a separate directory. Actually, I have a completely different, physical, 4TB HDD that I want to use for data storage.
The Docker UI (Portainer actually) gives no option to redirect the Docker Volume to another drive or directory.
Attempting to fool it with a hard or soft link failed.
Is there a way to change where the volume used by docker. Thus redirecting camera and logging to the new drive and directory?

I would prefer to keep Zoneminder and docker on 1 drive and just data on the other.
[BTW I am a programmer by trade, so you can speak geek to me. I am, however, a real newbie with both Docker and Zoneminder.]

Thank you.

Baylink
Posts: 330
Joined: Sun Jun 19, 2005 3:19 am

Re: ZM with Docker : Change Video Storage Volume

Post by Baylink » Tue Aug 20, 2019 3:19 pm

Is your separate storage volume visible inside the container, and how did you make that be so?

ccody73
Posts: 3
Joined: Sun Aug 11, 2019 9:28 pm

Re: ZM with Docker : Change Video Storage Volume

Post by ccody73 » Wed Aug 21, 2019 8:12 pm

No. I do not have the device mounted within the Docker directories.
That is, however, along the lines of what I want to do (e.g. have Zoneminder (which is hosted by Docker) write camera/event data to a device that the Docker instance of Zoneminder is not residing on.).

The media where I would like to use as a storage volume is just a straight forward mount (mount /dev/sdb1 /mnt) of a (formatted) drive partition on a local (SATA) HDD.
From what I can gather from other postings and documentation pages is that:
1. Creating a "Docker Volume" that is outside of the Docker directories is either not supported or not advisable (I forget which).
2. Creating a symbolic link to the other HDD from within the Docker directories and then creating the Docker Volume referencing the symbolic link is also not advised.

I had thought that creating a Docker Bind-Mount would be the way to go.
However, I would prefer to have the advice of someone who already knows the best way to get this done.

Thanks for taking a look for me.

Baylink
Posts: 330
Joined: Sun Jun 19, 2005 3:19 am

Re: ZM with Docker : Change Video Storage Volume

Post by Baylink » Thu Aug 22, 2019 1:30 am

Gotcha.

The thing you need an answer to is a Docker question, and I'm not (yet, at least) a Docker guy; hopefully one will wander along.

jbnsec
Posts: 3
Joined: Thu Aug 22, 2019 12:39 am

Re: ZM with Docker : Change Video Storage Volume

Post by jbnsec » Thu Aug 22, 2019 2:00 am

I have done this before with a different image using bind mounting.
Make sure the permissions are correct on the target directory then specify -v in your run command.

As an example using bind mounting /root in an ubuntu docker container to one within thatguy's home directory.

Code: Select all

docker run -v /home/thatguy/test/ub-root:/root -it ubuntu /bin/bash
In your case it would probably be:

Code: Select all

-v /mnt:/var/cache/zoneminder
Although I would put it in a subdirectory so you didn't expose anything that may end up at the root of an ext formatted drive (if it's on one) then make sure to set the permissions on the directory to match the zoneminder cache directory.

JB

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests