zabbix-docker/Dockerfiles/snmptraps/centos/Dockerfile

73 lines
2.6 KiB
Docker
Raw Normal View History

FROM quay.io/centos/centos:stream9-minimal
2022-07-05 14:46:20 +02:00
ARG MAJOR_VERSION=6.4
2024-01-29 12:58:57 +01:00
ARG ZBX_VERSION=${MAJOR_VERSION}.11
2019-05-10 16:11:07 +02:00
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
2021-10-16 17:49:19 +02:00
ENV TERM=xterm \
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL \
ZBX_SNMP_TRAP_DATE_FORMAT=+%Y%m%d.%H%M%S ZBX_SNMP_TRAP_FORMAT="\n" \
ZBX_SNMP_TRAP_USE_DNS=false
2020-04-26 18:45:42 +02:00
2021-10-16 17:49:19 +02:00
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
2020-04-26 18:45:42 +02:00
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
2021-10-16 17:49:19 +02:00
org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.title="zabbix-snmptraps" \
org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.version="${ZBX_VERSION}"
STOPSIGNAL SIGTERM
2019-05-30 20:21:16 +02:00
RUN set -eux && \
2021-10-12 02:08:40 +02:00
INSTALL_PKGS="bash \
tzdata \
shadow-utils \
2021-10-12 02:08:40 +02:00
net-snmp" && \
microdnf -y install \
--disablerepo "*" \
--enablerepo "baseos" \
--enablerepo "appstream" \
--setopt=install_weak_deps=0 \
--setopt=keepcache=0 \
--best \
--nodocs ${INSTALL_PKGS} && \
2021-10-16 17:49:19 +02:00
groupadd \
--system \
--gid 1995 \
zabbix && \
useradd \
--system \
--comment "Zabbix monitoring system" \
-g zabbix \
--uid 1997 \
--shell /sbin/nologin \
--home-dir /var/lib/zabbix/ \
zabbix && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \
touch /var/lib/net-snmp/snmptrapd.conf && \
2020-04-26 18:45:42 +02:00
chown --quiet -R zabbix:root /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
chgrp -R 0 /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
chmod -R g=u /etc/snmp/ /var/lib/zabbix/ /var/tmp/ /var/run/ && \
microdnf -y clean all && \
2020-04-26 18:45:42 +02:00
rm -rf /var/cache/yum /var/lib/yum/yumdb/* /usr/lib/udev/hwdb.d/* && \
rm -rf /var/cache/dnf /etc/udev/hwdb.bin /root/.pki
EXPOSE 1162/UDP
WORKDIR /var/lib/zabbix/snmptraps/
2020-07-13 23:43:32 +02:00
VOLUME ["/var/lib/zabbix/snmptraps"]
COPY ["conf/etc/logrotate.d/zabbix_snmptraps", "/etc/logrotate.d/"]
COPY ["conf/etc/snmp/snmptrapd.conf", "/etc/snmp/"]
COPY ["conf/usr/sbin/zabbix_trap_handler.sh", "/usr/sbin/"]
2020-04-26 18:45:42 +02:00
USER 1997
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]