diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 3d27c2ba0b..54387d67c4 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -117,6 +117,8 @@ RUN chown -R root:root \ ENV NETDATA_LISTENER_PORT 19999 EXPOSE $NETDATA_LISTENER_PORT +ENV NETDATA_EXTRA_APK_PACKAGES="" + ENTRYPOINT ["/usr/sbin/run.sh"] HEALTHCHECK --interval=60s --timeout=10s --retries=3 CMD /usr/sbin/health.sh diff --git a/packaging/docker/README.md b/packaging/docker/README.md index 49083fb661..09acc843b4 100644 --- a/packaging/docker/README.md +++ b/packaging/docker/README.md @@ -157,6 +157,20 @@ Additionally, for each stable release, three tags are pushed, one with the full that would match that tag (for example, if `v1.30.1` were to be published, the `v1.30` tag would be updated to point to that instead of `v1.30.0`). +## Adding extra packages at runtime + +By default, the official Netdata container images do not include a number of optional runtime dependencies. You +can add these dependencies, or any other APK packages, at runtime by listing them in the environment variable +`NETDATA_EXTRA_APK_PACKAGES`. + +Commonly useful packages include: + +- `apcupsd`: For monitoring APC UPS devices. +- `libvirt-daemon`: For resolving cgroup names for libvirt domains. +- `lm-sensors`: For monitoring hardware sensors. +- `msmtp`: For email alert support. +- `netcat-openbsd`: For IRC alert support. + ## Health Checks Our Docker image provides integrated support for health checks through the standard Docker interfaces. diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index 9029e22b61..9c2fcba664 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -67,4 +67,17 @@ if [ -n "${NETDATA_CLAIM_URL}" ] && [ -n "${NETDATA_CLAIM_TOKEN}" ] && [ ! -f /v -daemon-not-running fi +if [ -n "${NETDATA_EXTRA_APK_PACKAGES}" ]; then + echo "Fetching APK repository metadata." + if ! apk update; then + echo "Failed to fetch APK repository metadata." + else + echo "Installing supplementary packages." + # shellcheck disable=SC2086 + if ! apk add --no-cache ${NETDATA_EXTRA_APK_PACKAGES}; then + echo "Failed to install supplementary packages." + fi + fi +fi + exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_LISTENER_PORT}" "$@"