<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/hardening-container-images-hbci55slz" -->

---
title: Hardening Container Images | daily.dev
description: A deep technical walkthrough of hardening a container image for PowerDNS Recursor, starting from a bloated 355MB official Debian-based image down to a 36MB...
canonical: https://daily.dev/posts/hardening-container-images-hbci55slz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Hardening Container Images | daily.dev
og:description: A deep technical walkthrough of hardening a container image for PowerDNS Recursor, starting from a bloated 355MB official Debian-based image down to a 36MB...
og:url: https://daily.dev/posts/hardening-container-images-hbci55slz
og:image: https://api.daily.dev/og/posts/hBCI55SlZ.png
og:image:alt: Hardening Container Images
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Hardening Container Images

**[Lobsters](https://daily.dev/sources/lobsters)** · 10 min read · 2 upvotes · 0 comments

## Summary

A deep technical walkthrough of hardening a container image for PowerDNS Recursor, starting from a bloated 355MB official Debian-based image down to a 36MB scratch-based image compiled statically with Musl. Techniques covered include using Linux Landlock to restrict filesystem and network access, generating seccomp syscall allowlists via strace, dropping capabilities, read-only filesystems with noexec tmpfs, automated daily rebuilds tracking upstream CVE fixes, generating CycloneDX/SPDX SBOMs, writing OpenVEX files to suppress irrelevant CVE findings, and signing images with cosign/Fulcio/Rekor via Sigstore for verifiable provenance. The author also built a custom launcher binary that doubles as a health-check tool and uses healthchecks.io to detect CI pipeline failures.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.grepular.com/Hardening_Container_Images>

## Questions this post answers

### How can I use Linux Landlock to sandbox a container's filesystem and network access?

A small custom C launcher program can be used as the container entrypoint to apply Landlock before handing control to the main application, restricting read access to only necessary paths (like config files, not /proc), restricting write access similarly, and restricting which TCP ports can be connected to or bound, with UDP bind restriction available on newer kernels. This blocks attackers from writing and executing malware or reaching command-and-control ports.

_Developers hardening container entrypoints can find practical Landlock patterns like this through daily.dev._

### How do I stop vulnerability scanners from generating false CVE noise for dependencies that aren't actually exploitable in my usage?

Write an OpenVEX file declaring which specific findings do not apply and why, then pass it to scanners like Trivy, Grype, or OSV Scanner in CI and attach it to the image as an attestation. For example, critical and high CVEs found in a bundled Handlebars.js dependency were suppressed this way after determining they didn't apply to how the library was actually used.

_Teams tuning out CVE noise with VEX can track these vulnerability-management practices via daily.dev._

### How can I verify a Docker image was built by a specific CI pipeline before running it?

Use cosign verify with the certificate-identity set to the CI pipeline path (for example a GitLab .gitlab-ci.yml on a specific branch) and certificate-oidc-issuer set to the identity provider (like gitlab.com), then supply the image reference. This works because a short-lived OIDC token from the CI system is exchanged for a Fulcio certificate, used by cosign to sign the image, with the signature logged in Sigstore's Rekor transparency log.

_Anyone verifying supply-chain provenance with cosign and Sigstore can follow this workflow via daily.dev._

## Similar posts on daily.dev

- [Hardening the Core: Container Validation and Malicious Package Defense](https://daily.dev/posts/hardening-the-core-container-validation-and-malicious-package-defense-fm50k0pnh) · Container Journal · 0 upvotes · 0 comments
- [Securing Docker images: harden, patch, and maintain them](https://daily.dev/posts/securing-docker-images-harden-patch-and-maintain-them-fnqtjltzh) · Aikido Security · 0 upvotes · 0 comments
- [Making the Most of Your Docker Hardened Images Trial – Part 1](https://daily.dev/posts/making-the-most-of-your-docker-hardened-images-trial-part-1-2qhxyp0db) · Docker · 1 upvotes · 0 comments
- [8 Container Security Best Practices for 2026](https://daily.dev/posts/8-container-security-best-practices-for-2026-j7ekstdq7) · Orca Security Blog · 4 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#docker](https://daily.dev/tags/docker), [#containers](https://daily.dev/tags/containers), [#sbom](https://daily.dev/tags/sbom)

[View this post on daily.dev](https://daily.dev/posts/hardening-container-images-hbci55slz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Hardening Container Images","url":"https://daily.dev/posts/hardening-container-images-hbci55slz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/hardening-container-images-hbci55slz"},"datePublished":"2026-09-08T21:11:44.438Z","dateModified":"2026-09-13T18:35:35.105Z","description":"A deep technical walkthrough of hardening a container image for PowerDNS Recursor, starting from a bloated 355MB official Debian-based image down to a 36MB...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c2a51f450d67dddbb1c66f8f2764ecfe?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c2a51f450d67dddbb1c66f8f2764ecfe?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/hardening-container-images-hbci55slz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,docker,containers,sbom","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Hardening Container Images"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/hardening-container-images-hbci55slz#faq","mainEntity":[{"@type":"Question","name":"How can I use Linux Landlock to sandbox a container's filesystem and network access?","acceptedAnswer":{"@type":"Answer","text":"A small custom C launcher program can be used as the container entrypoint to apply Landlock before handing control to the main application, restricting read access to only necessary paths (like config files, not /proc), restricting write access similarly, and restricting which TCP ports can be connected to or bound, with UDP bind restriction available on newer kernels. This blocks attackers from writing and executing malware or reaching command-and-control ports. Developers hardening container entrypoints can find practical Landlock patterns like this through daily.dev."}},{"@type":"Question","name":"How do I stop vulnerability scanners from generating false CVE noise for dependencies that aren't actually exploitable in my usage?","acceptedAnswer":{"@type":"Answer","text":"Write an OpenVEX file declaring which specific findings do not apply and why, then pass it to scanners like Trivy, Grype, or OSV Scanner in CI and attach it to the image as an attestation. For example, critical and high CVEs found in a bundled Handlebars.js dependency were suppressed this way after determining they didn't apply to how the library was actually used. Teams tuning out CVE noise with VEX can track these vulnerability-management practices via daily.dev."}},{"@type":"Question","name":"How can I verify a Docker image was built by a specific CI pipeline before running it?","acceptedAnswer":{"@type":"Answer","text":"Use cosign verify with the certificate-identity set to the CI pipeline path (for example a GitLab .gitlab-ci.yml on a specific branch) and certificate-oidc-issuer set to the identity provider (like gitlab.com), then supply the image reference. This works because a short-lived OIDC token from the CI system is exchanged for a Fulcio certificate, used by cosign to sign the image, with the signature logged in Sigstore's Rekor transparency log. Anyone verifying supply-chain provenance with cosign and Sigstore can follow this workflow via daily.dev."}}]}
```

