nginx/kubernetes-ingress/nic-docker-images
Claude Code and agent skill by nginx/kubernetes-ingress
- community
Checking that the SKILL.md file is still in the repository.
Docker image build system, Dockerfile structure, image variants, build scripts, and Makefile targets for NIC. Use when building container images, modifying the Dockerfile, adding new image variants, debugging image builds, or working with build scripts.
Install
npx vskill@latest install nginx/kubernetes-ingress/nic-docker-imagesSKILL.md
The same SKILL.md was published earlier as nginx/kubernetes-ingress/nic-docker-images.
NIC Docker Image Build System
Dockerfile Architecture
Single build/Dockerfile (~1100 lines), heavily multi-stage. The BUILD_OS arg selects which base image stage is used, and TARGET selects the final stage.
Supporting images built outside this Dockerfile:
build/dependencies/Dockerfile.ubi10builds the UBI package image published toghcr.io/nginx/dependencies/nginx-ubi, consumed via theUBI10_PACKAGES_IMAGEbuild arg (pinned by digest in theMakefile). Built bybuild-ubi-dependency.ymlon changes to that file, or locally withmake ubi10-dependency-image-local(requiresrhel_license).build/dependencies/tracking.info.defaultis copied in astracking.infoto attribute the install to NIC before the Plus licence reporter initialises.
Image Variants
make all-images builds 25 variants. Three axes combine:
- OS family: Debian 13 (trixie), Alpine 3.24, UBI 10 minimal
- NGINX edition: OSS or Plus, plus optional NAP WAF v4 / WAF v5 / DoS and FIPS on Alpine
- NGINX Agent version: v2 (default on NAP variants) or v3 (
-agentsuffixed stages)
| OS | OSS | Plus | Plus+WAF | Plus+WAFv5 | Plus+DoS | Plus+WAF+DoS | Plus+FIPS | Plus+WAF+FIPS | Plus+WAFv5+FIPS | |
|---|---|---|---|---|---|---|---|---|---|---|
| Debian | yes | yes | yes | yes | yes | yes | - | - | - | |
| Alpine | yes | yes | - | - | - | - | yes | yes | yes | |
| UBI 10 | yes | yes | yes | yes | yes | yes | - | - | - |
Architecture: amd64 + arm64 for OSS and Plus. NAP variants are amd64 only.
Agent v2 vs v3 -- easy to miss
- OSS and plain Plus images ship nginx-agent v3 only (
AGENT_V3_VERSION). - NAP WAF stages exist in pairs: the unsuffixed stage pins
AGENT_V2_VERSION, the-agentsuffixed stage pinsAGENT_V3_VERSION. For exampledebian-plus-nap(agent v2) anddebian-plus-nap-agent(agent v3). .github/data/matrix-images-nap.jsonbuilds both halves of each pair for WAF and WAF+DoS (nap_modules: wafandnap_modules: waf,dos). DoS-only (nap_modules: dos) builds on the standardplus-napstages (debian-plus-napandubi-10-plus-nap), which conditionally install Agent v3 whenNAP_MODULES=dos, publishing Agent v3 under standard tags without redundant-agentimage variants.- Both the local Makefile targets (
debian-image-dos-plus,ubi-image-dos-plus) and the CI matrix useplus-nap(debian-plus-nap,ubi-10-plus-nap) with Agent v3 for DoS-only images. - Python e2e tests distinguish the two agents with the
agentv2/agentv3pytest markers. - Matrix row schema and the checklist for adding an image: docs/developer/image-matrices.md.
Makefile Image Targets
All targets call $(DOCKER_CMD) = docker build --platform linux/$(ARCH) --target $(TARGET) -f build/Dockerfile.
| Target | BUILD_OS | NAP_MODULES | Agent | |
|---|---|---|---|---|
debian-image | debian | - | v3 | |
alpine-image | alpine | - | v3 | |
ubi-image | ubi | - | v3 | |
debian-image-plus | debian-plus | - | v3 | |
alpine-image-plus | alpine-plus | - | v3 | |
alpine-image-plus-fips | alpine-plus-fips | - | v3 | |
ubi-image-plus | ubi-10-plus | - | v3 | |
alpine-image-nap-plus-fips | alpine-plus-nap-fips | waf | v2 | |
alpine-image-nap-plus-fips-agent | alpine-plus-nap-fips-agent | waf | v3 | |
alpine-image-nap-v5-plus-fips | alpine-plus-nap-v5-fips | waf | v2 | |
alpine-image-nap-v5-plus-fips-agent | alpine-plus-nap-v5-fips-agent | waf | v3 | |
debian-image-nap-plus | debian-plus-nap | waf | v2 | |
debian-image-nap-plus-agent | debian-plus-nap-agent | waf | v3 | |
debian-image-nap-v5-plus | debian-plus-nap-v5 | waf | v2 | |
debian-image-nap-v5-plus-agent | debian-plus-nap-v5-agent | waf | v3 | |
debian-image-dos-plus | debian-plus-nap | dos | v3 | |
debian-image-nap-dos-plus | debian-plus-nap | waf,dos | v2 | |
debian-image-nap-dos-plus-agent | debian-plus-nap-agent | waf,dos | v3 | |
ubi-image-nap-plus | ubi-10-plus-nap | waf | v2 | |
ubi-image-nap-plus-agent | ubi-10-plus-nap-agent | waf | v3 | |
ubi-image-nap-v5-plus | ubi-10-plus-nap-v5 | waf | v2 | |
ubi-image-nap-v5-plus-agent | ubi-10-plus-nap-v5-agent | waf | v3 | |
ubi-image-dos-plus | ubi-10-plus-nap | dos | v3 | |
ubi-image-nap-dos-plus | ubi-10-plus-nap | waf,dos | v2 | |
ubi-image-nap-dos-plus-agent | ubi-10-plus-nap-agent | waf,dos | v3 |
Other targets: all-images (all 25, prunes the builder cache first), ubi10-dependency-image-local (UBI package image), push (docker push to PREFIX:TAG), patch-os (OS patches an existing image).
Plus images receive $(PLUS_ARGS): --secret id=nginx-repo.crt --secret id=nginx-repo.key plus NGINX_PLUS_VERSION and PLUS_PACKAGE_REPO.
TARGET Variable
make build accepts only local, container, download, goreleaser, debug and errors on anything else. The remaining stages are selected by CI or by make patch-os directly.
| Target | Use Case | |
|---|---|---|
local | Default -- binary pre-built on host, copied in | |
container | Binary built inside Docker (multi-arch capable) | |
goreleaser | Binary from GoReleaser dist/ (CI builds) | |
debug | Includes delve debugger | |
debug-container | Delve build with the binary compiled inside Docker | |
download | Extracts binary from a published Docker Hub image (DOWNLOAD_TAG, resolved by hack/docker.sh) | |
patched | OS patches an existing image (IMAGE_NAME) | |
local-prebuilt, goreleaser-prebuilt | Same as their counterparts but layered onto PREBUILT_BASE_IMG instead of rebuilding the OS stage |
Key Build Args
| Arg | Purpose | Source of truth | |
|---|---|---|---|
BUILD_OS | Base image stage | Makefile targets + Dockerfile stages | |
IC_VERSION | Ingress controller version | .github/data/version.txt | |
NGINX_PLUS_VERSION | NGINX Plus version | Makefile | |
NGINX_OSS_VERSION | NGINX OSS version | Makefile | |
AGENT_V2_VERSION / AGENT_V3_VERSION | nginx-agent version per variant | Makefile | |
NAP_MODULES | App Protect modules | Any of waf, dos, or waf,dos | |
NAP_WAF_VERSION, NAP_WAF_COMMON_VERSION, NAP_WAF_PLUGIN_VERSION, NAP_WAF_IPI_VERSION | NAP WAF package pins | Makefile | |
UBI10_PACKAGES_IMAGE | UBI package image, digest-pinned | Makefile (ghcr.io/nginx/dependencies/nginx-ubi) | |
PREBUILT_BASE_IMG | Base for *-prebuilt targets | GCR image ref (set by CI) | |
IMAGE_NAME | Image to patch for TARGET=patched | make patch-os / patch-image.yml | |
DOWNLOAD_TAG | Published tag for TARGET=download | hack/docker.sh | |
OSS_PACKAGE_REPO | Repo host for OSS packages | Makefile / CI inputs (defaults to packages.nginx.org) | |
AGENT_PACKAGE_REPO | Repo host for NGINX Agent packages | Makefile / CI inputs (defaults to packages.nginx.org) | |
PLUS_PACKAGE_REPO | Repo host for Plus packages | Makefile / CI inputs (defaults to pkgs.nginx.com) | |
WAF_PACKAGE_REPO | Repo host for F5 NAP WAF packages | Makefile / CI inputs (defaults to pkgs.nginx.com) | |
DOS_PACKAGE_REPO | Repo host for F5 NAP DoS packages | Makefile / CI inputs (defaults to pkgs.nginx.com) |
Do not hard-code IC_VERSION, NGINX_*_VERSION, AGENT_*_VERSION or NAP_WAF_* values in this file or in other docs as they change every release. Always reference the Makefile variables or .github/data/version.txt.
Build Scripts (build/scripts/)
| Script | Purpose | |
|---|---|---|
common.sh | Sets up directories, copies NGINX templates (v1/v2), sets file permissions (101:0), runs setcap on nginx binaries | |
agent.sh | Configures nginx-agent ownership; creates NMS compiler symlinks for NAP v4 | |
nap-waf.sh | Creates WAF directories (/etc/nginx/waf/nac-policies, /opt/app_protect/) | |
nap-dos.sh | Creates DoS directories (/root/app_protect_dos, /shared/cores) | |
ubi-setup.sh | UBI-specific: installs shadow-utils, creates nginx user/group (101:0) | |
ubi-clean.sh | UBI-specific: removes build-time packages, cleans dnf cache |
patch-os.sh is not in this repo -- the nginx-files stage fetches it from nginx/k8s-common (files/patch-os.sh). Changes to it must be made in that repository.
Package repo definitions (*.repo, *.sources, 90pkgs-nginx) are likewise fetched in nginx-files from cs.nginx.com and nginx/k8s-common, then rewritten with sed to inject the version, the *_PACKAGE_REPO host override, and the k8s-ic-<IC_VERSION> user-agent used for usage attribution.
Key Conventions
- All images run as UID 101 (nginx user), with
setcap cap_net_bind_servicefor ports 80/443 - Docker BuildKit always enabled: uses
--mount=type=bind,--mount=type=secret,--mount=type=cache - Plus credentials use
--secretmounts, neverCOPYinto layers - OSS builds use optional
--secretmounts (required=false) fornginx-repo.crt/nginx-repo.keyto authenticate against non-default repo hosts likepkgs-test.nginx.comwhen running authenticated CI builds. - Fixed upstream base images use pinned `@sha256:` digests for reproducibility; some stages intentionally use build-arg/tag-selected bases (for example
BUILD_OS,UBI10_PACKAGES_IMAGE, or download/prebuilt images) - FIPS variants build on
ghcr.io/nginx/alpine-fips; UBI variants build onredhat/ubi10-minimal - All images include
nginx-module-otel(OpenTelemetry) andnginx-agent(usage reporting) - Plus images add
njsandfips-checkmodules - Renovate manages base image digests and tool versions via
# renovate:comments
Gotchas
- Never store Plus credentials in image layers -- always use
--secretmounts - Never add
arm64to NAP image matrices -- NAP isamd64only - Always use
BUILD_OSto select variants, not separate Dockerfiles - Add or change NAP WAF stages in pairs. A new
foo-napstage needs a matchingfoo-nap-agentstage, a Makefile target, an entry inmake all-images, and both entries in.github/data/matrix-images-nap.json. DoS-only is the exception -- it builds the standardplus-napstages withNAP_MODULES=dos, which install Agent v3, and has no-agenttwin. - The
commonstage unifies all variants -- changes there affect every image common.shdetects Plus viaBUILD_OScontaining "plus" and creates OIDC directoriespatch-os.shlives innginx/k8s-common, notbuild/scripts/-- editing it here is impossibleUBI10_PACKAGES_IMAGEis digest-pinned in theMakefile; rebuildingbuild/dependencies/Dockerfile.ubi10requires bumping that digest afterwards- When adding new image dependencies, update the relevant OS-specific stage AND the common stage if needed
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/nic-docker-images/SKILL.md
Popularity
- Repository stars
- 5,081
- Repository forks
- 2,051
- 7-day trend score
- 43
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nginx/kubernetes-ingress/nic-docker-images)