pducharme / UniFi-Video-Controller

Docker for Unifi-Video Controller (Ubiquiti Networks)
199 stars 105 forks source link

Doesn't start on Windows Docker (MongoDB issue) #97

Closed Szuni79 closed 6 years ago

Szuni79 commented 6 years ago

Hi Folks,

Newly installed Win10 Pro, newly installed Docker docker pull pducharme/unifi-video-controller docker run --name unifi-video --cap-add SYS_ADMIN --cap-add DAC_READ_SEARCH -p 22:22 -p 1935:1935 -p 6666:6666 -p 7004:7004/udp -p 7080:7080 -p 7442:7442 -p 7443:7443 -p 7444:7444 -p 7445:7445 -p 7446:7446 -p 7447:7447 -p 10001:10001/udp -v /c/UVC/Data:/var/lib/unifi-video -v /c/UVC/Video:/var/lib/unifi-video/videos -e TZ=Europe/Budapest -e PUID=99 -e PGID=100 -e DEBUG=1 pducharme/unifi-video-controller On the consol coms the logs "... Daemon loaded successfully java_load done dropped capabilities." And from here nothing more. On the website "UPGRADING" is only shown.

If i leave the -v /c/UVC/Data:/var/lib/unifi-video parameter it starting fine. In this form i tried to do some recordings. They are on my disk, so its not a disk accessibility problem.

What is the problem? What should I change?

Szuni79 commented 6 years ago

Is it possible, that /var/lib/unifi-video can't be redirected to a folder on an NTFS partition? And the reason is the MongoDB?

Szuni79 commented 6 years ago

Hmm... if we use the -v switch on Windows, the folder will be shared via SAMBA/CIFS and MongoDB isnt fully compatible with it. So don't use shared folder for MongoDB!

But you can use mountable volumes. They arn't in your phisical filesystem but still outside your container. That is on the DockerVM. You can purge your Container, the volume is still there. It's enough for us in this case.

Let's create a Volume docker volume create UnifiVideoDataVolume and at the docker run (...)-v <data dir>:/var/lib/unifi-video (...) command must be UnifiVideoDataVolume instead of a directory of the host machine. Videos can be on shared directory.

So the right and working config (on Windows) is:

docker run \ --name unifi-video \ --cap-add SYS_ADMIN \ --cap-add DAC_READ_SEARCH \ -p 10001:10001 \ -p 1935:1935 \ -p 6666:6666 \ -p 7080:7080 \ -p 7442:7442 \ -p 7443:7443 \ -p 7444:7444 \ -p 7445:7445 \ -p 7446:7446 \ -p 7447:7447 \ -v :/var/lib/unifi-video \ -v :/var/lib/unifi-video/videos \ -e TZ=America/Los_Angeles \ -e PUID=99 \ -e PGID=100 \ -e DEBUG=1 \ pducharme/unifi-video-controller

fryfrog commented 6 years ago

Wow, I had no idea about this on Docker for Windows. That is mildly crazy. How do you feel about cloning the repo and doing something in the README.md that we can merge in for future Windows users?

I assume you can just do this for the data volume and still pass in a real path for the videos?

cameronetchart commented 6 years ago

I assume you can just do this for the data volume and still pass in a real path for the videos?

Yep! Just did this successfully today as a total Docker noob. I created a volume called UnifiVideoDataVolume and linked that to /var/lib/unifi-video, then I passed through a directory on my secondary HDD for /var/lib/unifi-video/videos. All the config files are now stored in my default docker volume, and the actual video files go to the mapped HDD folder. This also solved the forever UPGRADING error as discussed in the 1st post.

Side note, for anyone use using this docker container to migrate away from the windows java client, DON'T restore a backup from a windows controller to a linux/docker controller. Set it up as new. Learned the hard way the software is buggy and won't let you set the recording directory correctly.

fryfrog commented 6 years ago

Could you document how you did it and submit a README.md change via pull request? Or document it here and I can do it?

cameronetchart commented 6 years ago

I'm brand new to git, so hopefully I did this correctly? See above.

fryfrog commented 6 years ago

Perfect, thanks! :)