Skip to content

Containerfile: Use Icinga 2 Plugin Container - #11161

Open
oxzi wants to merge 1 commit into
masterfrom
containerfile-use-icinga2-plugins-container
Open

oxzi wants to merge 1 commit into
masterfrom
containerfile-use-icinga2-plugins-container

Conversation

@oxzi

@oxzi oxzi commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Outsource pinned check commands to an external container image1. This uncouples their versions from our Containerfile, belonging to a certain git tag. Afterward, the plugins can be updated independently of an Icinga 2 release.

Furthermore, the new container image1 comes with an SBOM of all check plugins. When inspecting the container image, these artifacts are now being picked up.


$ for c in mssql_health nwc_health postgres.pl ssl_cert; do podman run -t -it --rm icinga2:edge "/usr/lib/nagios/plugins/check_$c" --version; podman run -t -it --rm icinga2:external-plugins "/usr/lib/nagios/plugins/check_$c" --version; echo; done
[2026-11-06 14:00:11 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:11 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:11 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_mssql_health (1.5.10)
This nagios plugin comes with ABSOLUTELY NO WARRANTY. You may redistribute
copies of this plugin under the terms of the GNU General Public License.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_mssql_health $Revision: 2.9 $ [http://labs.consol.de/nagios/check_mssql_health]

[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_nwc_health $Revision: 1.4.9 $ [http://labs.consol.de/nagios/check_nwc_health]
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:12 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_nwc_health $Revision: 12.17.2 $ [http://labs.consol.de/nagios/check_nwc_health]

[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_postgres.pl version 2.25.0
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_postgres.pl version 2.26.0

[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_ssl_cert version 2.81.1
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 14:00:13 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
check_ssl_cert version 2.103.4

$ podman run -t -it --rm icinga2:external-plugins /usr/lib/nagios/plugins/check_ssl_cert -H icinga.com -c 3 -p 443 -w 7
[2026-11-06 13:53:23 +0000] information/DockerEntrypoint: Icinga 2 Docker entrypoint script started.
[2026-11-06 13:53:23 +0000] information/DockerEntrypoint: No node setup required based on environment variables.
[2026-11-06 13:53:23 +0000] information/DockerEntrypoint: Finished Icinga 2 Docker entrypoint script.
SSL_CERT OK - icinga.com:443, https, x509 certificate '*.icinga.com' (icinga.com) from 'Let's Encrypt' valid until Dec 14 08:24:39 2026 GMT (expires in 37 days)|days_chain_elem1=37;7;3;; days_chain_elem2=666;7;3;; days_chain_elem3=2127;7;3;; days_chain_elem4=2127;7;3;;

Fixes Icinga/docker-icinga2#170
Refs #10984

Footnotes

  1. https://github.com/Icinga/icinga2-plugins-container ↩ ↩2

@oxzi oxzi added this to the 2.17.0 milestone Nov 6, 2026
@oxzi
oxzi requested a review from julianbrost November 6, 2026 14:02
@oxzi oxzi added area/images Affects Icinga 2 container/docker images. backport-to-support/2.16 PRs with this label will automatically be backported to the v2.16 support branch. labels Nov 6, 2026
@cla-bot cla-bot Bot added the cla/signed label Nov 6, 2026
@oxzi
oxzi removed the request for review from julianbrost November 6, 2026 14:03
Comment thread Containerfile Resolved
@yhabteab

yhabteab commented Nov 6, 2026

Copy link
Copy Markdown
Member

Fixes Icinga/docker-icinga2#170

That issue is basically a duplicate of #10984 and is quite similar to #10854, so if fixing that issue with this PR, you could also fix both of the Icinga 2 issues as well.

@julianbrost

Copy link
Copy Markdown
Member

IMHO this PR is now starting to mix too many things and it's hard to follow, what change is done for what reason now. Please split this into individual commits at least.

In addition, the "--no-install-recommends" flag was lifted from "apt-get install", mirroring the old behavior before switching to the new Containerfile.

Which typically adds a lot of bloat as well. So please check what impact this has on the image size. Comparing the package lists and only adding what seems reasonably might be an idea as well. There haven't been a lot of complaints, and that might be a better balance between compatibility and image size.

@oxzi

oxzi commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

IMHO this PR is now starting to mix too many things and it's hard to follow, what change is done for what reason now. Please split this into individual commits at least.

In addition, the "--no-install-recommends" flag was lifted from "apt-get install", mirroring the old behavior before switching to the new Containerfile.

Which typically adds a lot of bloat as well. So please check what impact this has on the image size. Comparing the package lists and only adding what seems reasonably might be an idea as well. There haven't been a lot of complaints, and that might be a better balance between compatibility and image size.

Fair, I am going to drop the --no-install-recommends thingy. This is something for the future.

@yhabteab

yhabteab commented Nov 6, 2026

Copy link
Copy Markdown
Member

In addition, the "--no-install-recommends" flag was lifted from "apt-get install", mirroring the old behavior before switching to the new Containerfile.

Which typically adds a lot of bloat as well. So please check what impact this has on the image size. Comparing the package lists and only adding what seems reasonably might be an idea as well.

I think, this makes a lot of difference. As states this in #10854:

This resulted in a smaller image as less packages are being installed (188 instead of 265), but the python interpreter is no longer available.

I would also suggest to just install the missing packages as reported by users instead of doing the same thing what the old image did. That way, we would at least know why we're installing that many packages in our official image.

@oxzi
oxzi force-pushed the containerfile-use-icinga2-plugins-container branch 3 times, most recently from 832fa6a to 7ef7c92 Compare November 9, 2026 13:11
@oxzi
oxzi marked this pull request as ready for review November 10, 2026 08:17
@oxzi
oxzi requested a review from julianbrost November 10, 2026 08:17
@oxzi

oxzi commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

@julianbrost: Please take another look. The container image now copies everything from icinga2-plugins-container, pinned to the "wandering" tag trixie, which gets automatically reassigned for each new icinga2-plugins-container release.

Comment thread Containerfile Resolved
Comment thread Containerfile Resolved
@oxzi
oxzi force-pushed the containerfile-use-icinga2-plugins-container branch from 7ef7c92 to e73194f Compare November 11, 2026 09:33
@oxzi
oxzi requested a review from julianbrost November 11, 2026 09:35
Comment thread Containerfile Outdated
Comment on lines +116 to +120
COPY --from=ghcr.io/icinga/icinga2-plugins-container:trixie /usr/lib/nagios/plugins/* /usr/lib/nagios/plugins/
COPY --from=ghcr.io/icinga/icinga2-plugins-container:trixie /plugins.cdx.json /usr/share/sbom/

# Install the necessary runtime dependencies for the Icinga 2 binary and the monitoring-plugins.
RUN apt-get update && \
apt-get upgrade -y && \
RUN --mount=from=ghcr.io/icinga/icinga2-plugins-container:trixie,target=/plugins \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd introduce a build ARG for the image name. That avoids repeating it three times now and has the added benefit that you can build against a different version for testing purposes without having to modify the file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought about that but wanted to keep the diff small. Now, there is a global DEBIAN_VERSION to substitute trixie.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Containerfile:122
--------------------
 121 |     # Install the necessary runtime dependencies for the Icinga 2 binary and the monitoring-plugins.
 122 | >>> RUN --mount=from=ghcr.io/icinga/icinga2-plugins-container:${DEBIAN_VERSION},target=/plugins \
 123 | >>>     apt-get update && \
 124 | >>>     DEBIAN_FRONTEND=noninteractive apt-get upgrade -y && \
 125 | >>>     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
 126 | >>>         bc \
 127 | >>>         ca-certificates \
 128 | >>>         curl \
 129 | >>>         dumb-init \
 130 | >>>         file \
 131 | >>>         libboost-context1.83.0 \
 132 | >>>         libboost-coroutine1.83.0 \
 133 | >>>         libboost-date-time1.83.0 \
 134 | >>>         libboost-filesystem1.83.0 \
 135 | >>>         libboost-iostreams1.83.0 \
 136 | >>>         libboost-program-options1.83.0 \
 137 | >>>         libboost-regex1.83.0 \
 138 | >>>         libboost-system1.83.0 \
 139 | >>>         libboost-thread1.83.0 \
 140 | >>>         libcap2-bin \
 141 | >>>         libedit2 \
 142 | >>>         libldap-common \
 143 | >>>         libmariadb3 \
 144 | >>>         libmoosex-role-timer-perl \
 145 | >>>         libpq5 \
 146 | >>>         libprotobuf-lite32t64 \
 147 | >>>         libssl3 \
 148 | >>>         libsystemd0 \
 149 | >>>         mailutils \
 150 | >>>         monitoring-plugins \
 151 | >>>         msmtp \
 152 | >>>         msmtp-mta \
 153 | >>>         openssh-client \
 154 | >>>         openssl \
 155 | >>>         $(cat /plugins/debian-packages) && \
 156 | >>>     # Official Debian images automatically run `apt-get clean` after every install, so we don't need to do it here.
 157 | >>>     rm -rf /var/lib/apt/lists/*
 158 |     
--------------------
ERROR: failed to build: failed to solve: dockerfile parse error on line 122: 'from' doesn't support variable expansion, define alias stage instead

-- https://github.com/Icinga/icinga2/actions/runs/43001166329/job/130457548175

Oh noe :(

I have tested this locally with Podman, where it worked. So, I am going to undo this change, as otherwise there would be ARG usage everywhere except here, which would look very bug-ish.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, I would test if creating an intermediate stage would do.

Sorry using this thread as a chat with myself.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more try. As I just rumbled, I created an intermediate container stage where the ARG substitution is used in the FROM. It worked locally with Podman and the CI is past that step; seems to be working. Yay.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and has the added benefit that you can build against a different version for testing purposes without having to modify the file

By only having DEBIAN_VERSION as an ARG, this doesn't really solve what I had in mind there. With the current state, you can't (without editing the file) build this based on an edge version of that image (or a local name of that image).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I failed to peek into your mind correctly.

I have changed this to introduce an additional PLUGINS_VERSION ARG, defaulting to the DEBIAN_VERSION. Now it is possible to overwrite the Debian main version - including the plugins - as well as just overwriting the plugin version with --build-args.

Was that what you had in mind? Otherwise, please feel free to suggest changes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had hoped this doesn't need much peeking into my mind. 😅

I'd introduce a build ARG for the image name.

So that would be ARG PLUGINS_IMAGE=ghcr.io/icinga/icinga2-plugins-container:trixe and using that. This allows using --build-arg PLUGINS_IMAGE=ghcr.io/icinga/icinga2-plugins-container:trixe-edge or also --build-arg PLUGINS_IMAGE=localhost/plugins:dev.

@oxzi
oxzi force-pushed the containerfile-use-icinga2-plugins-container branch from e73194f to edc4c76 Compare November 11, 2026 10:09
@oxzi
oxzi requested a review from julianbrost November 11, 2026 10:09
@oxzi
oxzi force-pushed the containerfile-use-icinga2-plugins-container branch 2 times, most recently from e1c9113 to ce19ebd Compare November 11, 2026 10:25
Outsource pinned check commands to an external container image[0]. This
uncouples their versions from our Containerfile, belonging to a certain
git tag. Afterward, the plugins can be updated independently of an
Icinga 2 release.

Furthermore, the new container image[0] comes with an SBOM of all check
plugins. When inspecting the container image, these artifacts are now
being picked up.

[0]: https://github.com/Icinga/icinga2-plugins-container
@oxzi
oxzi force-pushed the containerfile-use-icinga2-plugins-container branch from ce19ebd to cc06caa Compare November 11, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/images Affects Icinga 2 container/docker images. backport-to-support/2.16 PRs with this label will automatically be backported to the v2.16 support branch. cla/signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check_ssl_cert needs host command which is missing in docker image

3 participants