2021-09-13 00:06:51 +02:00
|
|
|
# syntax=docker/dockerfile:1
|
2024-12-16 05:16:31 +01:00
|
|
|
ARG MAJOR_VERSION=7.4
|
2021-09-13 00:06:51 +02:00
|
|
|
ARG ZBX_VERSION=${MAJOR_VERSION}
|
|
|
|
ARG BUILD_BASE_IMAGE=zabbix-build-mysql:alpine-${ZBX_VERSION}
|
|
|
|
|
2024-02-13 17:07:53 +01:00
|
|
|
FROM ${BUILD_BASE_IMAGE} AS builder
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2024-12-06 06:20:01 +01:00
|
|
|
FROM alpine:3.21
|
2019-11-14 06:28:37 +01:00
|
|
|
|
2021-09-13 00:06:51 +02:00
|
|
|
ARG MAJOR_VERSION
|
|
|
|
ARG ZBX_VERSION
|
2021-10-16 17:49:19 +02:00
|
|
|
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
ENV TERM=xterm \
|
2024-12-23 13:22:01 +01:00
|
|
|
ZBX_VERSION=${ZBX_VERSION} ZBX_SOURCES=${ZBX_SOURCES} \
|
|
|
|
ZABBIX_USER_HOME_DIR="/var/lib/zabbix" \
|
|
|
|
ZABBIX_CONF_DIR="/etc/zabbix"
|
|
|
|
|
|
|
|
ENV ZBX_PERSISTENTBUFFERFILE="$ZABBIX_USER_HOME_DIR/buffer/agent2.db"
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2021-10-16 17:49:19 +02:00
|
|
|
LABEL org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" \
|
2019-11-14 06:28:37 +01:00
|
|
|
org.opencontainers.image.description="Zabbix agent 2 is deployed on a monitoring target to actively monitor local resources and applications" \
|
2021-09-13 00:06:51 +02:00
|
|
|
org.opencontainers.image.documentation="https://www.zabbix.com/documentation/${MAJOR_VERSION}/manual/installation/containers" \
|
2024-05-13 19:31:38 +02:00
|
|
|
org.opencontainers.image.licenses="AGPL v3.0" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.source="${ZBX_SOURCES}" \
|
|
|
|
org.opencontainers.image.title="Zabbix agent 2" \
|
|
|
|
org.opencontainers.image.url="https://zabbix.com/" \
|
2024-05-13 19:31:38 +02:00
|
|
|
org.opencontainers.image.vendor="Zabbix SIA" \
|
2021-10-16 17:49:19 +02:00
|
|
|
org.opencontainers.image.version="${ZBX_VERSION}"
|
2019-11-14 06:28:37 +01:00
|
|
|
|
|
|
|
STOPSIGNAL SIGTERM
|
|
|
|
|
2024-06-01 09:15:19 +02:00
|
|
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}-output/agent2/sbin/", "/usr/sbin/"]
|
2024-06-01 08:10:31 +02:00
|
|
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}-output/general/bin/*", "/usr/bin/"]
|
2024-12-23 13:22:01 +01:00
|
|
|
COPY --from=builder ["/tmp/zabbix-${ZBX_VERSION}-output/agent2/conf/", "${ZABBIX_CONF_DIR}/"]
|
2021-09-13 00:06:51 +02:00
|
|
|
|
2019-11-14 06:28:37 +01:00
|
|
|
RUN set -eux && \
|
2024-03-22 06:53:18 +01:00
|
|
|
INSTALL_PKGS="bash \
|
|
|
|
tzdata \
|
2022-01-22 13:44:37 +01:00
|
|
|
pcre2 \
|
2021-10-16 17:49:19 +02:00
|
|
|
coreutils \
|
2021-11-13 16:09:15 +01:00
|
|
|
smartmontools \
|
|
|
|
sudo \
|
2021-10-16 17:49:19 +02:00
|
|
|
iputils" && \
|
|
|
|
apk add \
|
|
|
|
--no-cache \
|
|
|
|
--clean-protected \
|
|
|
|
${INSTALL_PKGS} && \
|
|
|
|
addgroup \
|
|
|
|
--system \
|
|
|
|
--gid 1995 \
|
|
|
|
zabbix && \
|
|
|
|
adduser \
|
|
|
|
--system \
|
2020-12-19 18:25:51 +01:00
|
|
|
--gecos "Zabbix monitoring system" \
|
|
|
|
--disabled-password \
|
|
|
|
--uid 1997 \
|
|
|
|
--ingroup zabbix \
|
|
|
|
--shell /sbin/nologin \
|
2024-12-23 13:22:01 +01:00
|
|
|
--home ${ZABBIX_USER_HOME_DIR}/ \
|
2019-11-14 06:28:37 +01:00
|
|
|
zabbix && \
|
2024-01-18 16:19:02 +01:00
|
|
|
echo "zabbix ALL=(root) NOPASSWD: /usr/sbin/smartctl" >> /etc/sudoers.d/zabbix && \
|
2024-12-23 13:22:01 +01:00
|
|
|
mkdir -p ${ZABBIX_CONF_DIR} && \
|
|
|
|
mkdir -p ${ZABBIX_CONF_DIR}/zabbix_agent2.d && \
|
|
|
|
mkdir -p ${ZABBIX_USER_HOME_DIR} && \
|
|
|
|
mkdir -p ${ZABBIX_USER_HOME_DIR}/enc && \
|
|
|
|
mkdir -p ${ZABBIX_USER_HOME_DIR}/enc_internal && \
|
|
|
|
mkdir -p ${ZABBIX_USER_HOME_DIR}/buffer && \
|
|
|
|
chown --quiet -R zabbix:root ${ZABBIX_CONF_DIR}/zabbix_agent2_item_keys.conf \
|
|
|
|
${ZABBIX_CONF_DIR}/zabbix_agent2.d/ \
|
|
|
|
${ZABBIX_USER_HOME_DIR}/ && \
|
|
|
|
chown --quiet zabbix:root ${ZABBIX_CONF_DIR}/ && \
|
|
|
|
chgrp -R 0 ${ZABBIX_CONF_DIR}/zabbix_agent2_item_keys.conf \
|
|
|
|
${ZABBIX_CONF_DIR}/zabbix_agent2.d/ \
|
|
|
|
${ZABBIX_USER_HOME_DIR}/ && \
|
|
|
|
chgrp 0 ${ZABBIX_CONF_DIR} && \
|
|
|
|
chmod -R g=u ${ZABBIX_CONF_DIR}/zabbix_agent2_item_keys.conf \
|
|
|
|
${ZABBIX_CONF_DIR}/zabbix_agent2.d/ \
|
|
|
|
${ZABBIX_USER_HOME_DIR}/ && \
|
2024-12-25 06:28:21 +01:00
|
|
|
chmod g=u ${ZABBIX_CONF_DIR} && \
|
|
|
|
/usr/sbin/zabbix_agent2 -V
|
2019-11-14 06:28:37 +01:00
|
|
|
|
2020-08-05 23:21:01 +02:00
|
|
|
EXPOSE 10050/TCP 31999/TCP
|
2019-11-14 06:28:37 +01:00
|
|
|
|
2024-12-23 13:22:01 +01:00
|
|
|
WORKDIR ${ZABBIX_USER_HOME_DIR}
|
2019-11-14 06:28:37 +01:00
|
|
|
|
|
|
|
COPY ["docker-entrypoint.sh", "/usr/bin/"]
|
|
|
|
|
2023-09-12 18:35:24 +02:00
|
|
|
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
2019-11-14 06:28:37 +01:00
|
|
|
|
2020-04-25 23:23:08 +02:00
|
|
|
USER 1997
|
2019-11-14 06:28:37 +01:00
|
|
|
|
|
|
|
CMD ["/usr/sbin/zabbix_agent2", "--foreground", "-c", "/etc/zabbix/zabbix_agent2.conf"]
|