zabbix-docker/Dockerfiles/snmptraps/rhel/Dockerfile

111 lines
4.1 KiB
Docker
Raw Normal View History

FROM registry.access.redhat.com/ubi9/ubi-minimal:9.3
2021-06-11 23:07:45 +02:00
2022-07-05 14:46:20 +02:00
ARG MAJOR_VERSION=6.4
2024-03-25 17:58:45 +01:00
ARG RELEASE=13
ARG ZBX_VERSION=${MAJOR_VERSION}.13
2021-06-11 23:07:45 +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} \
2021-06-11 23:07:45 +02:00
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
2021-06-11 23:07:45 +02:00
2021-10-16 17:49:19 +02:00
LABEL description="Zabbix SNMP traps receiver" \
2021-06-11 23:07:45 +02:00
maintainer="alexey.pustovalov@zabbix.com" \
2023-03-07 08:49:55 +01:00
name="zabbix/zabbix-snmptraps-64" \
2021-06-11 23:07:45 +02:00
release="${RELEASE}" \
2023-03-07 08:49:55 +01:00
run="docker run --name zabbix-snmptraps --link zabbix-server:zabbix-server -p 162:1162/udp -d registry.connect.redhat.com/zabbix/zabbix-snmptraps-64:${ZBX_VERSION}" \
2021-06-11 23:07:45 +02:00
summary="Zabbix SNMP traps receiver" \
url="https://www.zabbix.com/" \
2021-10-16 17:49:19 +02:00
vendor="Zabbix LLC" \
version="${MAJOR_VERSION}" \
2021-06-11 23:07:45 +02:00
io.k8s.description="Zabbix SNMP traps receiver" \
io.k8s.display-name="Zabbix SNMP traps receiver" \
io.openshift.expose-services="162:1162" \
io.openshift.tags="zabbix,zabbix-snmp,snmp-traps" \
org.label-schema.build-date="${BUILD_DATE}" \
2021-10-16 17:49:19 +02:00
org.label-schema.description="Zabbix SNMP traps receiver" \
2023-03-07 08:49:55 +01:00
org.label-schema.docker.cmd="docker run --name zabbix-snmptraps --link zabbix-server:zabbix-server -p 162:1162/udp -d registry.connect.redhat.com/zabbix/zabbix-snmptraps-64:${ZBX_VERSION}" \
2021-06-11 23:07:45 +02:00
org.label-schema.license="GPL v2.0" \
2021-10-16 17:49:19 +02:00
org.label-schema.name="zabbix-snmptraps-rhel" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://zabbix.com/" \
2021-06-11 23:07:45 +02:00
org.label-schema.usage="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
2021-10-16 17:49:19 +02:00
org.label-schema.vcs-ref="${VCS_REF}" \
2021-06-11 23:07:45 +02:00
org.label-schema.vcs-url="${ZBX_SOURCES}" \
2021-10-16 17:49:19 +02:00
org.label-schema.vendor="Zabbix LLC" \
org.label-schema.version="${ZBX_VERSION}"
2021-06-11 23:07:45 +02:00
STOPSIGNAL SIGTERM
COPY ["licenses", "/licenses"]
RUN --mount=type=tmpfs,target=/var/lib/dnf/ \
set -eux && \
2021-10-12 02:08:40 +02:00
INSTALL_PKGS="bash \
shadow-utils \
2021-06-11 23:07:45 +02:00
net-snmp" && \
microdnf -y install \
--disableplugin=subscription-manager \
2021-10-16 17:49:19 +02:00
--disablerepo="*" \
2023-01-30 11:29:52 +01:00
--enablerepo "ubi-9-baseos-rpms" \
--enablerepo "ubi-9-appstream-rpms" \
2021-10-16 17:49:19 +02:00
--setopt=install_weak_deps=0 \
--setopt=keepcache=0 \
2021-10-16 17:49:19 +02:00
--best \
--setopt=tsflags=nodocs \
${INSTALL_PKGS} && \
microdnf -y update \
--disableplugin=subscription-manager \
--disablerepo "*" \
--enablerepo "ubi-9-baseos-rpms" \
--setopt=install_weak_deps=0 \
--best \
--setopt=tsflags=nodocs \
tzdata && \
microdnf -y reinstall \
--disableplugin=subscription-manager \
--disablerepo "*" \
--enablerepo "ubi-9-baseos-rpms" \
--setopt=install_weak_deps=0 \
--setopt=keepcache=0 \
--best \
--setopt=tsflags=nodocs \
tzdata && \
2021-10-16 17:49:19 +02:00
groupadd \
--system \
--gid 1995 \
zabbix && \
2021-06-11 23:07:45 +02:00
useradd \
2021-10-16 17:49:19 +02:00
--system \
--comment "Zabbix monitoring system" \
-g zabbix \
2021-06-11 23:07:45 +02:00
--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 && \
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
2021-06-11 23:07:45 +02:00
EXPOSE 1162/UDP
WORKDIR /var/lib/zabbix/snmptraps/
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/"]
USER 1997
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]