# Use a minimal base image FROM alpine:latest # Install necessary packages RUN apk add --no-cache snmpd python3 py3-pip # Install any additional Python packages if needed RUN pip3 install --no-cache-dir random # Copy the custom script into the container COPY custom_snmp_script.py /usr/local/bin/custom_snmp_script.py # Make the script executable RUN chmod +x /usr/local/bin/custom_snmp_script.py # Configure snmpd to use the custom script RUN echo "extend .1.3.6.1.4.1.38446.1.2.4.1.9.1 /usr/local/bin/custom_snmp_script.py" >> /etc/snmp/snmpd.conf # Expose the SNMP port EXPOSE 161/udp # Start snmpd CMD ["snmpd", "-f"]