tusc / ntopng-udm

ntopng Docker image for the UDM base and UDM pro
164 stars 20 forks source link

The podman run command given fails to mount the /mnt/data/ntopng/redis dir into the container... #9

Open kahlkevin opened 4 years ago

kahlkevin commented 4 years ago

The README.md @0b67c64 offers this command to run the container:

podman run -d --net=host --restart always \
   --name ntopng \
   -v /mnt/data/ntopng/GeoIP.conf:/etc/GeoIP.conf \
   -v /mnt/data/ntopng/ntopng.conf:/etc/ntopng/ntopng.conf \
   -v /mnt/data/ntopng/redis.conf:/etc/redis/redis.conf \
   -v /mnt/data/ntopng/lib:/var/lib/ntopng \
   docker.io/tusc/ntopng-udm:latest

Shouldn't there also be a -v /mnt/data/ntopng/redis:/var/lib/redis argument?

SamErde commented 3 years ago

This block is working fine for me on UDM firmware 1.8.3-beta2 and controller version 6.0.36. What UDM versions are you on?

SamErde commented 3 years ago

I updated to official 1.8.3 with controller 6.0.41 last night, and this is still working on my UDM.

jsermer commented 3 years ago

I found that if the redis podman volume mount is not present, when the container is stopped/deleted, the ntopng admin password and other ntopng preferences are reset to their respective defaults. If the volume mount is present, then that information persists. So I think the documentation should be updated to include -v /mnt/data/ntopng/redis:/var/lib/redis

jsermer commented 3 years ago

One additional comment I should make....you need to create the redis dir with the proper ownership:

uid/gids inside container

root@router:/# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Jun23 ?        00:00:00 /bin/bash /entrypoint.sh
redis       16     1  0 Jun23 ?        00:21:54 /usr/bin/redis-server 127.0.0.1:6379
ntopng      22     1 93 Jun23 ?        6-16:32:42 ntopng /etc/ntopng/ntopng.conf
root@router:/# id redis
uid=101(redis) gid=102(redis) groups=102(redis)
root@router:/# id ntopng
uid=999(ntopng) gid=999(ntopng) groups=999(ntopng)

create dirs outside container

mkdir /mnt/data/ntopng/redis
chown 101:102 /mnt/data/ntopng/redis

Additionally, if the docs do not mention it, I also set the main ntopng lib dir as follows (ntopng uid/gid are both 999):

mkdir /mnt/data/ntopng/lib
chown 999:999 /mnt/data/ntopng/lib