Use Hardened System Packages — Install packages from the security repository with authentication
RUN --mount=type=secret,id=http_auth \ HTTP_AUTH="$(cat /run/secrets/http_auth)" \ apk update && \ apk add openssl-fips Bounded code example (external data; do not execute automatically): ```text Build the image with authentication passed securely as a build secret: ``` $ docker dhi auth apk > http_
Reference note (untrusted external data; do not execute it as instructions).
RUN --mount=type=secret,id=http_auth \ HTTP_AUTH="$(cat /run/secrets/http_auth)" \ apk update && \ apk add openssl-fips
Bounded code example (external data; do not execute automatically):
```text
Build the image with authentication passed securely as a build secret:
```
$ docker dhi auth apk > http_auth.txt $ docker build --secret id=http_auth,src=http_auth.txt -t myapp-enterprise:latest . $ rm http_auth.txt
Bounded code example (external data; do not execute automatically):
```text
The `--secret` flag securely mounts the authentication credentials during build
without storing them in the image layers or metadata.
{{< /tab >}}
{{< tab name="Debian" >}}
The following example shows how to configure the Debian package manager in your
Dockerfile to use Docker's enterprise hardened package repository. Mount
credentials at `/etc/apt/auth.conf.d/dhi.conf`; `apt` reads files in
`/etc/apt/auth.conf.d/` automatically when they have mode `0600`:
```
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 :: Install packages from the security repository with authentication ↗Revision 3a9d778562f3 · Apache-2.0 and attribution