jshridha / docker-blueiris

Blueiris in a docker using wine!
Apache License 2.0
106 stars 52 forks source link

Network - Detecting Cameras #31

Closed Deverall closed 3 years ago

Deverall commented 3 years ago

I am hoping someone might be able to help me here. I am a little new to docker containers and am trying to get this bad boy up and running. I was able to get the BI docker container installed and running, however, I am not able to detect any of the cameras. I am not sure how the network binding works so maybe someone can help point me in the right direction here.

I am testing another project (https://github.com/thirtythreeforty/neolink) using a docker container that allows me to use Reolink D800 cameras without an NVR. I was able to get that up and the RTSP streams online, but I am not able to see my camera from this container.

Here is a screenshot from an ffprobe via the CLI of the container (Alpine Linux) streaming the camera: 2020-08-31_09-53-28

Here is a screen shot from the BI container with the same command via CLI: 2020-08-31_10-18-39

FYI I am using docker desktop via Windows 10 while testing.

2020-08-31_11-05-59

ANY help would be greatly appreciated!

TonyBrobston commented 3 years ago

@Deverall I'm not sure whether this will help or not, but I am using some Unifi G3 cameras over rtsp.

I first turned rtsp on, on one camera. I then had some trouble getting them configured in Blue Iris. So as a test to make sure rtsp was working I looked up how to test through VLC Media Player. (starting at step #3 https://www.unifore.net/ip-video-surveillance/how-to-play-rtsp-video-stream-of-ip-cameras-on-vlc-player-quicktime-player.html).

Once I could tell that was working I started googling on how to setup rtsp in Blue Iris. I went to "Add new camera", gave it a Long and Short name, then setup my camera with these settings: image You'll need to know the ip of your camera and the "Main stream" path. For me this was /s0. In unifi it showed like this: image

I first tested without rtsp authentication; initially it didn't seem to work, but the second or third time I tried it started working. I also verified it was working by trying to connect through VLC Media Player again without username/password and it didn't allow me to connect.

This may be too general of information; so if you know all of this already I apologize.

leonowski commented 3 years ago

Docker Desktop in Windows is a bit confusing when it comes to networking. There's a lot of layers going on and can quickly get confusing (at least for me when I was helping someone at my office with similar problems).

The important thing to remember is that Docker Desktop runs in a VM. So you have layers from the Windows Host <--VM --> Docker host. I don't really fully understand most of it. This doc tries to explain the networking for:

https://docs.docker.com/docker-for-windows/networking/

Since the 2 containers should be in the same layer, they should be able to talk to each other. There's a special hostname for Docker Desktop called "host.docker.internal" which should point to the VM host's IP from inside the container. You can try that as the hostname for endpoints running in containers (as long as the ports are published at docker run using the -p 80:80 type of syntax OR if you specified the container to use host networking).

The other way to handle this is to get the internal IP of the Alpine container using this command in docker:

docker inspect -f "{{ .NetworkSettings.IPAddress }}" <containerNameOrId>

Use that internal IP for other containers that want to access the container. The problem with this is that the docker internal IPs will change with each restart. So, it's best to use the port mapping or host networking along with "host.docker.internal." Remember, the containers themselves have their own IP addresses for internal communication.

One final thought:

I used to have these headaches with Docker Desktop on Windows as well and at work. But, I switched to WSL2 on Windows and I'm running docker directly on that. It seems to be a less of a headache so far for me. I highly recommend trying WSL2.

Deverall commented 3 years ago

Thanks for the info guys, it really just came down to the networking between containers and using the host.docker.internal:8554 for the IP got it working. I really appreciate your guys willingness to help!

TonyBrobston commented 3 years ago

@Deverall Would you mind closing this if you're good to go?