You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add a section in the Rust guide to use DHI (#23728)
<!--Delete sections as needed -->
## 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](#23565) and
[Ruby](#23691) DHI updates.
## Reviews
<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->
- [ ] Technical review
- [x] Editorial review
- [ ] Product review
---------
Co-authored-by: Craig Osterhout <craig.osterhout@docker.com>
# Create a new stage for running the application that contains the minimal
119
+
# We use dhi.io/static for the final stage because it’s a minimal Docker Hardened Image runtime (basically “just # enough OS to run the binary”), which helps keep the image small and with a lower attack surface compared to a # # full Alpine/Debian runtime.
@@ -122,11 +288,11 @@ To list images, run the `docker images` command.
122
288
123
289
```console
124
290
$ docker images
125
-
REPOSITORYTAGIMAGE IDCREATED SIZE
126
-
docker-rust-image latest 8cae92a8fbd6 3 minutes ago 123MB
291
+
IMAGEIDDISK USAGECONTENT SIZEEXTRA
292
+
docker-rust-image-dhi:latest99a1b925a8d6 11.6MB2.45MB U
127
293
```
128
294
129
-
You should see at least one image listed, including the image you just built `docker-rust-image:latest`.
295
+
You should see at least one image listed, including the image you just built `docker-rust-image-dhi:latest`.
130
296
131
297
## Tag images
132
298
@@ -137,7 +303,7 @@ An image is made up of a manifest and a list of layers. Don't worry too much abo
137
303
To create a new tag for the image you built, run the following command.
138
304
139
305
```console
140
-
$ docker tag docker-rust-image:latest docker-rust-image:v1.0.0
306
+
$ docker tag docker-rust-image-dhi:latest docker-rust-image-dhi:v1.0.0
141
307
```
142
308
143
309
The `docker tag` command creates a new tag for an image. It doesn't create a new image. The tag points to the same image and is just another way to reference the image.
@@ -146,31 +312,29 @@ Now, run the `docker images` command to see a list of the local images.
146
312
147
313
```console
148
314
$ docker images
149
-
REPOSITORY TAG IMAGE ID CREATED SIZE
150
-
docker-rust-image latest 8cae92a8fbd6 4 minutes ago 123MB
151
-
docker-rust-image v1.0.0 8cae92a8fbd6 4 minutes ago 123MB
152
-
rust latest be5d294735c6 4 minutes ago 113MB
315
+
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
316
+
docker-rust-image-dhi:latest 99a1b925a8d6 11.6MB 2.45MB U
317
+
docker-rust-image-dhi:v1.0.0 99a1b925a8d6 11.6MB 2.45MB U
153
318
```
154
319
155
-
You can see that two images start with `docker-rust-image`. You know they're the same image because if you take a look at the `IMAGE ID` column, you can see that the values are the same for the two images.
320
+
You can see that two images start with `docker-rust-image-dhi`. You know they're the same image because if you take a look at the `IMAGE ID` column, you can see that the values are the same for the two images.
156
321
157
322
Remove the tag you just created. To do this, use the `rmi` command. The `rmi` command stands for remove image.
158
323
159
324
```console
160
-
$ docker rmi docker-rust-image:v1.0.0
161
-
Untagged: docker-rust-image:v1.0.0
325
+
$ docker rmi docker-rust-image-dhi:v1.0.0
326
+
Untagged: docker-rust-image-dhi:v1.0.0
162
327
```
163
328
164
329
Note that the response from Docker tells you that Docker didn't remove the image, but only "untagged" it. You can check this by running the `docker images` command.
165
330
166
331
```console
167
332
$ docker images
168
-
REPOSITORY TAG IMAGE ID CREATED SIZE
169
-
docker-rust-image latest 8cae92a8fbd6 6 minutes ago 123MB
170
-
rust latest be5d294735c6 6 minutes ago 113MB
333
+
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
334
+
docker-rust-image-dhi:latest 99a1b925a8d6 11.6MB 2.45MB U
171
335
```
172
336
173
-
Docker removed the image tagged with `:v1.0.0`, but the `docker-rust-image:latest` tag is available on your machine.
337
+
Docker removed the image tagged with `:v1.0.0`, but the `docker-rust-image-dhi:latest` tag is available on your machine.
0 commit comments