scottlamb / moonfire-nvr

Moonfire NVR, a security camera network video recorder
Other
1.25k stars 138 forks source link

Cant add cameras to docker container #297

Closed chachew closed 4 months ago

chachew commented 9 months ago

I have successfully gotten the docker container created and running the web UI using the sample docker compose file. Now im at the point that i want to start adding cameras using the config script but it just runs quick and doesnt do much that i can tell. Logs below.

Also i cant find any way to access the containers shell. There seems to be no shell/bash or anything within this container. Ive tried the built in Windows Docker Desktop exec tab and that errors out because there is no shell. Ive tried manually connecting via docker exec -it <container-name-or-id> /bin/bash and that doesnt exist.

Logs from docker compose run --rm moonfire-nvr config 2>debug-log 2023-12-13T10:04:04.709126  INFO main moonfire_nvr::cmds: Opening /var/lib/moonfire-nvr/db/db in ReadWrite mode with SQLite version 3.39.2 2023-12-13T10:04:04.712898  INFO main moonfire_db::db: Loading video sample entries 2023-12-13T10:04:04.712944  INFO main moonfire_db::db: Loaded 0 video sample entries 2023-12-13T10:04:04.712950  INFO main moonfire_db::db: Loading sample file dirs 2023-12-13T10:04:04.712984  INFO main moonfire_db::db: Loaded 0 sample file dirs 2023-12-13T10:04:04.712997  INFO main moonfire_db::db: Loading cameras 2023-12-13T10:04:04.713012  INFO main moonfire_db::db: Loaded 0 cameras 2023-12-13T10:04:04.713024  INFO main moonfire_db::db: Loading streams 2023-12-13T10:04:04.713046  INFO main moonfire_db::db: Loaded 0 streams 2023-12-13T10:04:04.716542 ERROR main moonfire_base: panic location=/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.20.0/src/cursive_runnable.rs:75:24 payload=called Result::unwrap() on an Err value: Os { code: 6, kind: Uncategorized, message: "No such device or address" } backtrace= 0: moonfire_base::tracing_setup::panic_hook at ./home/runner/work/moonfire-nvr/moonfire-nvr/server/base/tracing_setup.rs:105:22 1: core::ops::function::Fn::call at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:79:5 2: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2021:9 3: std::panicking::rust_panic_with_hook at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:735:13 4: std::panicking::begin_panic_handler::{{closure}} at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:609:13 5: std::sys_common::backtrace::__rust_end_short_backtrace at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:170:18 6: rust_begin_unwind at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5 7: core::panicking::panic_fmt at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14 8: core::result::unwrap_failed at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1652:5 9: core::result::Result<T,E>::unwrap at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1077:23 10: cursive::cursive_runnable::CursiveRunnable::run at ./home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cursive-0.20.0/src/cursive_runnable.rs:75:9 11: moonfire_nvr::cmds::config::run at ./home/runner/work/moonfire-nvr/moonfire-nvr/server/src/cmds/config/mod.rs:58:5 12: moonfire_nvr::Args::run at ./home/runner/work/moonfire-nvr/moonfire-nvr/server/src/main.rs:50:32 13: moonfire_nvr::main at ./home/runner/work/moonfire-nvr/moonfire-nvr/server/src/main.rs:101:11 14: core::ops::function::FnOnce::call_once at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5 15: std::sys_common::backtrace::__rust_begin_short_backtrace at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:154:18 16: std::rt::lang_start::{{closure}} at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:166:18 17: core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:284:13 18: std::panicking::try::do_call at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40 19: std::panicking::try at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19 20: std::panic::catch_unwind at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14 21: std::rt::lang_start_internal::{{closure}} at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:48 22: std::panicking::try::do_call at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40 23: std::panicking::try at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19 24: std::panic::catch_unwind at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14 25: std::rt::lang_start_internal at ./rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:20 26: main

scottlamb commented 9 months ago

Sorry for the delay; I missed the email notification for this issue.

Also i cant find any way to access the containers shell. There seems to be no shell/bash or anything within this container.

That's correct. The Docker container for this has literally just the Moonfire executable; nothing else.

I've assumed that Docker takes care of including in its mount namespace things like device files, and that's been true for me running Docker engine on Linux. But maybe it's not true in your environment with Windows Docker Desktop. I'm wondering in particular if there's no /dev/tty, which could be the cause of the No such device or address error. Maybe you have to click a checkbox at launch time or something to make it appear (or actually work when opened). On Linux, there's a -t option to make Docker allocate a tty, as noted in the docker-run manpage:

       -t, --tty=true|false
          Allocate a pseudo-TTY. The default is false.

I've never used Windows Docker Desktop; is there some equivalent of the following command? I'm wondering how the output compares to mine.

(This command also assumes that the host has a /bin/ls on it that only depends on /lib and /usr/lib.)

[slamb@pi4 ~]$ docker run --volume /bin:/bin:ro --volume /lib:/lib:ro --volume /usr/lib:/usr/lib:ro --entrypoint /bin/ls --rm -it ghcr.io/scottlamb/moonfire-nvr:v0.7.11 -laF /dev
total 4
drwxr-xr-x 5 0 0    340 Jan  3 15:42 ./
drwxr-xr-x 1 0 0   4096 Jan  3 15:42 ../
crw--w---- 1 0 5 136, 0 Jan  3 15:42 console
lrwxrwxrwx 1 0 0     13 Jan  3 15:42 fd -> /proc/self/fd/
crw-rw-rw- 1 0 0   1, 7 Jan  3 15:42 full
drwxrwxrwt 2 0 0     40 Jan  3 15:42 mqueue/
crw-rw-rw- 1 0 0   1, 3 Jan  3 15:42 null
lrwxrwxrwx 1 0 0      8 Jan  3 15:42 ptmx -> pts/ptmx
drwxr-xr-x 2 0 0      0 Jan  3 15:42 pts/
crw-rw-rw- 1 0 0   1, 8 Jan  3 15:42 random
drwxrwxrwt 2 0 0     40 Jan  3 15:42 shm/
lrwxrwxrwx 1 0 0     15 Jan  3 15:42 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 0 0     15 Jan  3 15:42 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 0 0     15 Jan  3 15:42 stdout -> /proc/self/fd/1
crw-rw-rw- 1 0 0   5, 0 Jan  3 15:42 tty
crw-rw-rw- 1 0 0   1, 9 Jan  3 15:42 urandom
crw-rw-rw- 1 0 0   1, 5 Jan  3 15:42 zero