How to get SNMP packets to my node-red docker image?

A UPS is sending traps to the host of the node-red (in a docker).
I have installed node-red-node-snmp (node) - Node-RED

-how can I get the SNMP packets to the docker image?
my iptables config:

$ sudo iptables -L
# Warning: iptables-legacy tables present, use iptables-legacy to see them
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  anywhere             anywhere             udp dpt:snmp-trap

Chain FORWARD (policy DROP)
target     prot opt source               destination         
DOCKER-USER  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (3 references)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             172.17.0.2           tcp dpt:1880
ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:9001
ACCEPT     tcp  --  anywhere             172.18.0.2           tcp dpt:1883
ACCEPT     tcp  --  anywhere             172.18.0.3           tcp dpt:http-alt

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination         
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-ISOLATION-STAGE-2 (3 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere            
DROP       all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-USER (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            
pi@lys:~ $ 

You need to open UDP ports 161 and 162 to your Docker container first.

-p 161:161/udp
-p 162:162/udp

@TotallyInformation thanks - this reminds me of the last time I needed to find out how/where my docker was configured.
now I need to figure it out again.

If you use docker compose, you can configure docker containers using simple config files which you can annotate, you might find that easier.

@TotallyInformation Yes, I am using this for some services,

$ cat docker-compose.yml 
version: '3.8'
services:
  mqtt:
    container_name: mqtt
    image: eclipse-mosquitto:2.0
    restart: unless-stopped
    volumes:
      - "/home/pi/mosquitto-data:/mosquitto"
    ports:
      - "1883:1883"
      - "9001:9001"
    command: "mosquitto -c /mosquitto-no-auth.conf"

  zigbee2mqtt:
    depends_on:
      - mqtt
    container_name: zigbee2mqtt
    image: koenkk/zigbee2mqtt
    restart: unless-stopped
    volumes:
      #- ./data:/app/data
      - /home/pi/zigbee2mqtt-data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 8080:8080
    environment:
      - TZ=Europe/Berlin
    devices:
      # Make sure this matched your adapter location
      #- /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00:/dev/ttyACM0
      - /dev/ttyUSB0:/dev/ttyUSB0


but still fail to see where node-red is started:

$ docker images 
REPOSITORY           TAG       IMAGE ID       CREATED         SIZE
koenkk/zigbee2mqtt   latest    567088e9e6af   4 months ago    82.8MB
koenkk/zigbee2mqtt   <none>    ab272e315125   4 months ago    82.8MB
koenkk/zigbee2mqtt   <none>    e6bf13d00050   5 months ago    187MB
nodered/node-red     latest    35f3062b67d1   9 months ago    407MB
koenkk/zigbee2mqtt   <none>    5e16c0dd46a7   18 months ago   143MB
eclipse-mosquitto    2.0       79117ae3185f   18 months ago   9.91MB
hello-world          latest    1ec996c686eb   19 months ago   4.85kB

I also see a /var/lib/docker/volumes/node_red_data/_data/node_modules/node-red-contrib-telegrambot-home/docker-compose.yml

  • but cannot be sure whatever this is somehow in use too?

It isn't in that compose file. Check other compose files.