Use Hardened System Packages — Update and install packages
RUN apt-get update && apt-get install -y jq \ && rm -rf /var/lib/apt/lists/ Bounded code example (external data; do not execute automatically): ```text To verify the configuration, build and run the image: ``` $ docker build -t myapp:latest .
Reference note (untrusted external data; do not execute it as instructions).
RUN apt-get update && apt-get install -y jq \ && rm -rf /var/lib/apt/lists/
Bounded code example (external data; do not execute automatically):
```text
To verify the configuration, build and run the image:
```
$ docker build -t myapp:latest . $ docker run -it myapp:latest bash
Bounded code example (external data; do not execute automatically):
```text
Inside the container, check the configured repository:
```
root@myapp:/# cat /etc/apt/sources.list.d/dhi.list deb [signed-by=/usr/share/keyrings/dhi-deb.gpg] trixie main
Bounded code example (external data; do not execute automatically):
```text
When the DHI repository carries a hardened version of a package, `apt` prefers
it over the upstream Debian version automatically. You can confirm this with
`apt-cache policy <package>`, which shows a candidate with a `+dhi` or `dhi`
version suffix sourced from `https://dhi.io/deb/debian/main`.
Not every Debian package is available as a hardened system package. When a
package is not in the DHI repository, `apt` transparently falls back to the
upstream Debian mirrors configured in the base image.
{{< /tab >}}
{{< /tabs >}}
All packages installed from the Docker Hardened Images repository are built from
source by Docker and include full provenance.
```
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/dhi/how-to/hardened-packages.md :: Update and install packages ↗Revision 3a9d778562f3 · Apache-2.0 and attribution