zabbix-docker/snmptraps/ubuntu/Dockerfile
2020-12-18 15:25:32 -05:00

56 lines
2.1 KiB
Docker

FROM ubuntu:focal
ARG MAJOR_VERSION=5.4
ARG ZBX_VERSION=${MAJOR_VERSION}
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV TERM=xterm ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
MIBDIRS=/var/lib/snmp/mibs/ietf:/var/lib/snmp/mibs/iana:/usr/share/snmp/mibs:/var/lib/zabbix/mibs MIBS=+ALL
LABEL org.opencontainers.image.title="zabbix-snmptraps-ubuntu" \
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
org.opencontainers.image.vendor="Zabbix LLC" \
org.opencontainers.image.url="https://zabbix.com/" \
org.opencontainers.image.description="Zabbix SNMP traps receiver" \
org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
org.opencontainers.image.version="${ZBX_VERSION}"
STOPSIGNAL SIGTERM
RUN set -eux && \
echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && \
addgroup --system --gid 1995 --quiet zabbix && \
adduser --quiet \
--system --disabled-login \
--ingroup zabbix --ingroup root \
--uid 1997 \
--home /var/lib/zabbix/ \
zabbix && \
apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
tzdata \
snmp-mibs-downloader \
snmptrapd && \
download-mibs && \
mkdir -p /var/lib/zabbix && \
mkdir -p /var/lib/zabbix/snmptraps && \
mkdir -p /var/lib/zabbix/mibs && \
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/ && \
rm -rf /var/lib/apt/lists/*
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/"]
USER 1997
CMD ["/usr/sbin/snmptrapd", "-n", "-C", "-c", "/etc/snmp/snmptrapd.conf", "-Lo", "-A"]