Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

Client Workspace

Container image hardening and supply-chain checks in CI: base images, scan gates and signing

Container image hardening in CI means every image starts from an approved, minimal base image, runs without root or secrets, passes a scan gate that blocks only fixable serious findings, and is rebuilt on a schedule before it is signed. Netbase sequences this work as policy first, scanning second and signing last.

Book a solution review See the related solution

By Netbase Commerce and Platform Engineering Desk · Reviewed by David (CEO) · Updated · 10 min read

star

This guide is for CTOs, tech leads and platform owners whose containers are built from public tags and whose scanners report findings nobody has triaged. It belongs to Netbase's cloud platform engineering work and sits next to the DevOps and platform engineering service, where the pipeline checks are designed.

In this guide

Why is an image scanner on its own not enough?

A scanner reports known vulnerabilities in the packages it finds. It does not choose the base image, remove the shell from the runtime layer, stop the process running as root or keep a password out of a layer. Most image risk is decided before the scanner runs.

The NIST Application Container Security Guide (SP 800-190) groups image risks into vulnerabilities, configuration defects, embedded malware, embedded clear-text secrets and the use of untrusted images. Only the first group is what a vulnerability scanner is built to find; the others need a base-image policy, a hardened Dockerfile and checks on configuration and secrets.

A scanner that only warns is not a control, and one that blocks on everything gets bypassed. The useful middle is a written rule for what stops the build.

What should a base-image policy say?

A base-image policy is a one-page rule that names which images a team may build from, who owns them and how they are refreshed. Copy the clauses below and fill in the brackets.

  1. Approved families. Services build only from [list per runtime: a minimal distribution image, a distroless or runtime-only image, an official language image] pulled from [approved registry or internal mirror].
  2. Owner. [Role] owns each family, follows its advisories and publishes the current digest.
  3. Pinning. Dockerfiles reference base images by digest, updated by an automated pull request, never by a floating tag alone.
  4. Refresh. The approved digests are refreshed at least [weekly]; every service image is rebuilt within [n days] of a base-image update.
  5. Runtime contents. The final stage contains no compilers, package managers or shells unless the exception register lists them.
  6. Exceptions. Any other base image needs a recorded reason, an owner and an expiry date.

The Docker guidance on building best practices supports each clause: trusted, minimal base images, digest pinning and frequent rebuilds. It also names the trade-off: a pinned digest opts out of automatic security fixes, which is why clause 4 exists.

Which checks run where, and what does each one catch?

Check Where it runs What it catches What it misses
Base-image allow list Build, before the first layer Untrusted or unapproved images Vulnerabilities inside an approved image
Dockerfile lint and configuration check Pull request Root user, secrets in build arguments, latest tags The packages themselves
Secret scan of layers Build, after the image is assembled Keys, tokens and certificates left in any layer Secrets fetched at runtime (by design)
Vulnerability scan of the full image Build, before push Known flaws in system packages and libraries Flaws published later; unknown flaws
Registry rescan Daily, on stored images New advisories against images already released Images running that never reached the registry
Signature and provenance verification Deploy or admission Images not built by your pipeline, or changed after the build A vulnerable image your pipeline did build and sign

Scan the full image filesystem, not only the application dependencies. The OWASP Docker Security Cheat Sheet adds the configuration side, including running as a non-root user, a read-only root filesystem where possible and dropping Linux capabilities the service does not need.

Which findings should fail the build?

  • Critical or high vulnerability with a fixed version available, in the runtime image

    Gate action
    Fail the build
    Reason
    The fix exists; shipping without it is a choice
  • Vulnerability listed as actively exploited

    Gate action
    Fail the build, also on registry rescan
    Reason
    Exploitation is no longer hypothetical
  • Secret found in any layer

    Gate action
    Fail the build; revoke and rotate the secret
    Reason
    Layers stay readable in every copy of the image
  • Unapproved base image or process running as root

    Gate action
    Fail the build
    Reason
    Policy breach, independent of package versions
  • Critical or high finding with no fix yet

    Gate action
    Ticket with deadline and compensating control
    Reason
    Blocking cannot produce a fix
  • Medium and low findings

    Gate action
    Report; batch into the regular update
    Reason
    Blocking on them trains people to bypass the gate
  • Findings only in build stages that are not shipped

    Gate action
    Record only
    Reason
    They do not reach production

Deadlines for the ticketed findings should come from one patching rule for the whole application, not from the scanner's defaults; the security patching policy template sets those tiers and the exception record.

How do you add the checks in order?

  1. Write the base-image policy

    and inventory which base each service uses today.

  2. Harden the Dockerfiles

    Move to multi-stage builds so compilers and package managers stay in the build stage, add a non-root user, remove secrets from build arguments and pin base images by digest.

  3. Add the scan gate in report mode

    for a few release cycles, and fix the backlog the first runs expose.

  4. Switch the gate to blocking

    with the rules above; every exception gets an owner and an expiry date.

  5. Automate rebuild and rescan

    Rebuild service images when the base digest changes and rescan stored images daily against new advisories.

  6. Sign and verify

    Sign each image in the pipeline after it passes the gate, attach the SBOM and provenance, and verify the signature before deploy.

The Docker documentation on multi-stage builds explains step 2: the final image copies only the build output, leaving build tools behind. For step 6, the Sigstore documentation on signing containers describes keyless signing, where the pipeline's identity is used instead of a stored signing key; the secrets management guide covers the same identity federation for cloud access.

Signing comes last because a signature proves who built an image, not that it is safe. The order of SBOMs, dependency policy and provenance across all artifacts, not only images, is set out in the software supply chain security guide, and the SLSA levels describe how provenance requirements grow.

Where should verification happen at deploy?

Verify at the last point before an image runs. On Kubernetes that is an admission policy that rejects unsigned images, unapproved registries and root users. The Kubernetes guide to verifying signed artifacts shows cosign checks and admission enforcement, and the Kubernetes Pod Security Standards define a restricted profile that requires non-root containers.

On managed container services without an admission layer, verify in the deploy job and deploy by digest, so the verified image is the one that runs. Start in audit mode and switch to deny once the report is clean.

When should you not add a check yet?

Do not move every service to distroless images while engineers still debug through a shell in the container; give them another way to inspect it first. Do not block on medium findings: the backlog grows faster than a small team can fix it, and the gate gets bypassed. Do not build a private base-image catalogue for two services; the official minimal images plus digest pinning and automated update requests cover them.

Do not add signing before anything verifies signatures, and do not treat a clean scan as proof of safety: it covers only known flaws.

Where AI fits

AI helps sort scanner output, never approve it. An assistant can group findings by base image and package, flag which ones a base-image refresh would clear and draft Dockerfile changes for a non-root user or a multi-stage build. AI is integrated into every Netbase service, and Netbase works with the major commercial and open-source AI tools and models, chosen per project.

Engineers review every proposed Dockerfile change, decide every exception and own the gate rules. No model receives rights to change the gate, approve an exception or push an image to a production registry.

What delivery record exists, and what does not

Netbase's published security practices include secure code review and version control, TLS in transit and AES at rest, role-based access control, MFA for admin dashboards, vulnerability scanning and penetration testing, and disaster recovery. The cloud providers Netbase uses are AWS, Google Cloud, DigitalOcean and Cloudflare; no partner tier or cloud certification is claimed.

Netbase works as offshore development partner on a multi-tenant cloud ERP for a US client, delivered as SaaS to small and mid-sized businesses, where every release reaches many tenants.

Netbase holds ISO 27001 certification and a SOC 2 Type II attestation for its own operations; neither certifies a client's images or pipeline. Delivery follows a six-step lifecycle with weekly reviews, and most projects run on fixed-price contracts. Netbase does not publish scan results, vulnerability counts or a timeline for an image-hardening programme; this guide explains a method, not a case study.

Alternatives: who owns image hardening, and how do you choose?

Option Fits when Watch for
Each service team owns its Dockerfile and scan results Few services, experienced engineers in every team Base images drift apart; nobody owns the refresh
A platform team owns approved base images and the gate Several teams or many services The platform team becomes a queue unless exceptions are fast
Vendor-maintained hardened base images Teams that prefer to buy the refresh rhythm Lock-in to one image source
An external partner sets it up, your team runs it No in-house platform engineer yet Gate rules and exception ownership must transfer at handover

Choose by three criteria: how many services and runtimes you build, whether someone can own base-image refresh every week, and who will decide exceptions after launch. For the compute choice behind the images, see serverless or containers per workload; for the code-level checks that run in the same pipeline, see the secure development lifecycle guide.

Limits of this guide

  • It does not compare scanners, registries or hardened-image vendors by feature or score.
  • It does not cover runtime detection, host hardening or network policy inside the cluster.

Plan the next step with a Netbase consultant

Frequently asked questions

Block critical and high findings that have a fixed version in the runtime image, and any flaw listed as actively exploited. A critical finding with no fix available should open a ticket with a deadline and a compensating control, because blocking the build cannot produce a fix.

No. They remove shells and package managers, which helps security but also removes the tools engineers debug with. Adopt them once the team has another way to inspect a running service.

Scanning and signing answer different questions. A scan says whether known flaws are present; a signature says the image came from your pipeline unchanged. Signing only helps once a deploy step verifies it.

Next step

If you want your base images, Dockerfiles and pipeline gates reviewed before the next release, book a solution review with Netbase.

AI-ready cloud platform engineering for SaaS and commerce workloads AI-ready cloud platform engineering for SaaS and commerce workloads

Netbase provides cloud platform engineering for SaaS and commerce teams that need a secure, repeatable home for their software and its AI features, on AWS, Google Cloud, DigitalOcean or Cloudflare. We design the architecture, write the environments as code, connect managed and AI services and hand over a platform your team can run, built the way we run ours.

Learn More
line
AI-assisted DevOps and platform engineering for routine releases AI-assisted DevOps and platform engineering for routine releases

Netbase provides DevOps and platform engineering for SaaS and commerce teams to make releases routine instead of risky. We set up CI/CD pipelines, repeatable environments and observability on AWS, Google Cloud, DigitalOcean or Cloudflare, with AI assistance for tests, reviews and incident triage, so every change ships the same way and problems surface before customers notice.

Learn More
line
Application security assurance for web, SaaS and AI features Application security assurance for web, SaaS and AI features

Netbase provides application security testing for product and engineering leaders to find and fix vulnerabilities before release, including in AI features. We review code with AI-assisted triage, scan dependencies and test running applications, then rank findings and retest fixes. Netbase's own alignment with ISO 27001 and SOC 2 Type II covers Netbase's operations, never your application.

Learn More
line
SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules SaaS product accelerator: launch an AI-ready SaaS on proven Netbase modules

A SaaS product accelerator is a set of reusable Netbase modules for accounts, billing, roles and integrations that helps founders and product teams launch subscription software faster, with room for in-product AI from the first release. Reusing these modules can shorten development time, and the approach is proven on Printcart, Netbase's own web-to-print SaaS.

Learn More
line

Work with Netbase remotely

Every Netbase engagement is delivered remotely, so clients in any country and any industry can work with us; Netbase has worked with clients in 80 countries. Contracts and invoices are issued by Netbase JSC, and payment is made by bank transfer to Netbase JSC's company account or PayPal Business. Talk to the CEO, Huy Nguyen (David), on WhatsApp or by email.

Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

project@netbasejsc.com

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase