Skip to content

Conversation

@edithturn
Copy link

Description

Updated the Rust language guide to include Docker Hardened Images (DHI).

Changes include:

  • Added DHI as an option with tab-based layout (Official image / Hardened image)
  • Added a DHI-based Dockerfile example
  • Updated build instructions to match docker init behavior
  • Added DHI quickstart link in "Related information"

This follows the same structure used in the Bun and Ruby DHI updates.

Reviews

  • Technical review
  • Editorial review
  • Product review

@netlify
Copy link

netlify bot commented Nov 16, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 8caefe4
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6957fcc0acbb0d0008c274ec
😎 Deploy Preview https://deploy-preview-23728--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@igor-alexandrov
Copy link
Contributor

@edithturn I mirrored Rust images to my account, and the actual language version is 1.91.1. Maybe the guide should be updated to it?

@edithturn
Copy link
Author

edithturn commented Nov 22, 2025

@edithturn I mirrored Rust images to my account, and the actual language version is 1.91.1. Maybe the guide should be updated to it?

Hi @igor-alexandrov , thank you for the review and for pointing this out! 🙌
I’ve updated the Rust version to the latest one as suggested.

While testing, I also noticed that one of the dependencies in the Hello World base example (used by this part of the docs) didn’t compile with Rust 1.91.1 (but worked with 1.70.0), so I opened a PR to update the Cargo.toml and fix the build there as well:
👉 https://github.com/docker/docker-rust-hello/pull/1

Thanks again for the feedback, I really appreciate it!

@craig-osterhout
Copy link
Contributor

craig-osterhout commented Dec 18, 2025

Thanks @edithturn. Sorry, we had to quietly pause all reviews/changes for the surprise DHI free updates. Can you help update this based on that?
Essentially, for DHI, mirroring is no longer required, and users can directly use the public images at dhi.io/<image>:<tag> as long as they authenticate.

@edithturn
Copy link
Author

Hi @craig-osterhout, I updated the documentation with public Docker Hardened Images. I compiled and tested everything, and it is working fine!
Please, we also need to update Cargo. toml, the corresponding PR is here: docker/docker-rust-hello#1

Appreciate your time for reviewing!

Thanks!

Copy link
Contributor

@craig-osterhout craig-osterhout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating, @edithturn. I left a couple suggestions.

To pull Docker Hardened Images, authenticate once with Docker:

```bash
docker login
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
docker login
docker login dhi.io

Use DHIs from the dhi.io registry, for example:

```bash
FROM dhi.io/rust:${RUST_VERSION}-alpine AS build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example, so not critical, but no tag with -alpine exists. Suggest:

FROM dhi.io/rust:${RUST_VERSION}-alpine3.22-dev AS build

################################################################################
# Create a stage for building the application.

FROM rust:${RUST_VERSION}-alpine AS build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but it looks like this should be the dhi example.

FROM dhi.io/rust:${RUST_VERSION}-alpine3.22-dev AS build


################################################################################
# Create a new stage for running the application that contains the minimal
FROM alpine:3.18 AS final
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but suggest using a dhi as the runtime also.

FROM dhi.io/alpine-base:3.22 AS final

Could probably also use static dhi with the compiled binary for even less attack surface.

Docker Hardened Images (DHIs) are minimal, secure, and production-ready base images maintained by Docker.
They help reduce vulnerabilities and simplify compliance. For more details, see [Docker Hardened Images](/dhi/).

{{< tabs >}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's only one tab. Suggest using 2 tabs, one for doi/docker init, and one for dhi. For example, see the bun guide at https://raw.githubusercontent.com/docker/docs/refs/heads/main/content/guides/bun/containerize.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants