Hello,
I need to install an Ubuntu container on RB5009, but I have an issue. Everything downloads and saves, but when I try to start it, it starts and then stops after 2-3 seconds without any information in the logs.
Why do you need Ubuntu container on RB5009???
Generally, I need to run this.: this unifi-cam-proxy. com
Containers are not virtual machines. You don’t need to run the whole OS there. You only run specific apps with containers.
In your case they have a docker image: https://unifi-cam-proxy.com/#docker
no need for any ubuntu
Yes, I saw it and tried it, but I don’t know how to add the .pem file to the container because it stops after running.)
That might be a problem, normally you can use a mount to get that on Mikrotik container. But based on quick look at compose YAML/Dockerfile, it uses a file mapping (not a path) and the .PEM lives in the root so you can’t just mount that.
Possible to workaround the lack of file-level mapping in /container. But you’d have to modify the container’s code’s entrypoint.sh to use a different path the /root, and re-build it locally based on https://github.com/keshavdv/unifi-cam-proxy/tree/main (specifically https://github.com/keshavdv/unifi-cam-proxy/blob/main/docker/entrypoint.sh).
So, I figured out how to run one camera through unifi-cam-proxy. I just put this command on CMD: unifi-cam-proxy --host {NVR IP} --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam’
After the first run, I connected to Mikrotik via SSH and put clien.pem on the app folder. However, I have several cameras. The official instructions suggest using docker-compose with the following code:
version: “3.5”
services:
proxy-1:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes:
- “./client.pem:/client.pem”
command: unifi-cam-proxy --host {NVR IP} --mac ‘AA:BB:CC:00:11:22’ --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam’
proxy-2:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes: - “./client.pem:/client.pem”
command: unifi-cam-proxy --host {NVR IP} --mac ‘AA:BB:CC:33:44:55’ --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam’
My question is how to add several proxies (proxy-1, proxy-2, etc.) on the CMD field without running several dockers on Mikrotik.
I think the idea is you ran one container per proxy, so you can bring up another instance of the unifi-cam-proxy for a 2nd, 3rd, etc. NVR
See https://unifi-cam-proxy.com/#multiple-cameras
FWIW, when you see the Docker Compose for something, if it has multiple children, it’s multiple containers, so in their example this is actually TWO container “proxy-1” and “proxy-2”:
version: "3.5"
services:
proxy-1:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes:
- "./client.pem:/client.pem"
command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:00:11:22' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
proxy-2:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes:
- "./client.pem:/client.pem"
command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:33:44:55' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
So, I have started in two containers and it consumes too many resources: CPU and RAM.
Is there a way to run multiple cameras on a single container?
Is there a way to run multiple cameras on a single container?
Containers kinda designed to run one “EXE”, so unifi-cam-proxy follows that model. So you can download source, modifying it, and re-build the container locally using Docker Build. There are techniques like using http://supervisord.org in Dockertfile/enterpoint.sh to have it launch multiple processes…
But I’m thinking it’a the video transcoding that’s using the CPU/memory, than the containers themselves. The FFMPEG library it uses is resource intensive. So I’m not sure it’s going to be dramatically different CPU with two-proxys-in-one container. Memory likely be lower if combined since it doesn’t have the container 2nd image in RAM.