22title : Use the DHI CLI
33linkTitle : Use the CLI
44weight : 50
5- keywords : dhictl , CLI, command line, docker hardened images
6- description : Learn how to install and use dhictl , the command-line interface for managing Docker Hardened Images.
5+ keywords : docker dhi , CLI, command line, docker hardened images
6+ description : Learn how to install and use docker dhi , the command-line interface for managing Docker Hardened Images.
77---
88
9- ` dhictl ` is a command-line interface (CLI) tool for managing Docker Hardened Images:
9+ The ` docker dhi ` command-line interface (CLI) is a tool for managing Docker Hardened Images:
1010- Browse the catalog of available DHI images and their metadata
1111- Mirror DHI images to your Docker Hub organization
1212- Create and manage customizations of DHI images
@@ -15,23 +15,14 @@ description: Learn how to install and use dhictl, the command-line interface for
1515
1616## Installation
1717
18- ` dhictl ` will be available by default on [ Docker Desktop] ( https://docs.docker.com/desktop/ ) soon .
19- In the meantime, you can install ` dhictl ` manually as a Docker CLI plugin or as a standalone binary.
18+ The ` docker dhi ` CLI is available in [ Docker Desktop] ( https://docs.docker.com/desktop/ ) version 4.65 and later .
19+ You can also install the standalone ` dhictl ` binary.
2020
21- ### Docker CLI Plugin
21+ ### Docker Desktop
2222
23- 1 . Download the ` dhictl ` binary for your platform from the [ releases] ( https://github.com/docker-hardened-images/dhictl/releases ) page.
24- 2 . Rename the binary:
25- - ` docker-dhi ` on _ Linux_ and _ macOS_
26- - ` docker-dhi.exe ` on _ Windows_
27- 3 . Copy it to the CLI plugins directory:
28- - ` $HOME/.docker/cli-plugins ` on _ Linux_ and _ macOS_
29- - ` %USERPROFILE%\.docker\cli-plugins ` on _ Windows_
30- 4 . Make it executable on _ Linux_ and _ macOS_ :
31- - ` chmod +x $HOME/.docker/cli-plugins/docker-dhi `
32- 5 . Run ` docker dhi ` to verify the installation.
23+ The ` docker dhi ` command is included in Docker Desktop 4.65 and later. No additional installation is required.
3324
34- ### Standalone Binary
25+ ### Standalone binary
3526
36271 . Download the ` dhictl ` binary for your platform from the
3728 [ releases] ( https://github.com/docker-hardened-images/dhictl/releases ) page.
@@ -41,64 +32,82 @@ In the meantime, you can install `dhictl` manually as a Docker CLI plugin or as
4132
4233## Usage
4334
44- > [ !NOTE]
45- >
46- > The following examples use ` dhictl ` to reference the CLI tool. Depending on
47- > your installation, you may need to replace ` dhictl ` with ` docker dhi ` .
48-
4935Every command has built-in help accessible with the ` --help ` flag:
5036
5137``` bash
52- dhictl --help
53- dhictl catalog list --help
38+ docker dhi --help
39+ docker dhi catalog list --help
5440```
5541
56- ### Browse the DHI Catalog
42+ ### Browse the DHI catalog
5743
5844List all available DHI images:
5945
6046``` bash
61- dhictl catalog list
47+ docker dhi catalog list
6248```
6349
6450Filter by type, name, or compliance:
6551
6652``` bash
67- dhictl catalog list --type image
68- dhictl catalog list --filter golang
69- dhictl catalog list --fips
53+ docker dhi catalog list --type image
54+ docker dhi catalog list --filter golang
55+ docker dhi catalog list --fips
56+ docker dhi catalog list --stig
7057```
7158
7259Get details of a specific image, including available tags and CVE counts:
7360
7461``` bash
75- dhictl catalog get < image-name>
62+ docker dhi catalog get < image-name>
7663```
7764
78- ### Mirror DHI Images {tier="DHI Select & DHI Enterprise"}
65+ ### Mirror DHI images {tier="DHI Select & DHI Enterprise"}
7966
8067Start mirroring one or more DHI images to your Docker Hub organization:
8168
8269``` bash
83- dhictl mirror start --org my-org \
70+ docker dhi mirror start --org my-org \
8471 -r dhi/golang,my-org/dhi-golang \
8572 -r dhi/nginx,my-org/dhi-nginx \
8673 -r dhi/prometheus-chart,my-org/dhi-prometheus-chart
8774```
8875
76+ Mirror with dependencies:
77+
78+ ``` bash
79+ docker dhi mirror start --org my-org -r golang --dependencies
80+ ```
81+
8982List mirrored images in your organization:
9083
9184``` bash
92- dhictl mirror list --org my-org
85+ docker dhi mirror list --org my-org
9386```
9487
95- Stop mirroring an image :
88+ Filter mirrored images by name or type :
9689
9790``` bash
98- dhictl mirror stop --org my-org dhi-golang
91+ docker dhi mirror list --org my-org --filter python
92+ docker dhi mirror list --org my-org --type image
93+ docker dhi mirror list --org my-org --type helm-chart
9994```
10095
101- ### Customize DHI Images {tier="DHI Select & DHI Enterprise"}
96+ Stop mirroring one or more images:
97+
98+ ``` bash
99+ docker dhi mirror stop dhi-golang --org my-org
100+ docker dhi mirror stop dhi-python dhi-golang --org my-org
101+ ```
102+
103+ Stop mirroring and delete the repositories:
104+
105+ ``` bash
106+ docker dhi mirror stop dhi-golang --org my-org --delete
107+ docker dhi mirror stop dhi-golang --org my-org --delete --force
108+ ```
109+
110+ ### Customize DHI images {tier="DHI Select & DHI Enterprise"}
102111
103112The CLI can be used to create and manage DHI image customizations. For detailed
104113instructions on creating customizations, including the YAML syntax and
@@ -108,29 +117,37 @@ Quick reference for CLI commands:
108117
109118``` bash
110119# Prepare a customization scaffold
111- dhictl customization prepare --org my-org golang 1.25 \
120+ docker dhi customization prepare golang 1.25 \
121+ --org my-org \
112122 --destination my-org/dhi-golang \
113123 --name " golang with git" \
114- --tag-suffix " _git" \
115124 --output my-customization.yaml
116125
117126# Create a customization
118- dhictl customization create --org my- org my-customization.yaml
127+ docker dhi customization create my-customization.yaml -- org my-org
119128
120129# List customizations
121- dhictl customization list --org my-org
130+ docker dhi customization list --org my-org
131+
132+ # Filter customizations by name, repository, or source
133+ docker dhi customization list --org my-org --filter git
134+ docker dhi customization list --org my-org --repo dhi-golang
135+ docker dhi customization list --org my-org --source golang
122136
123137# Get a customization
124- dhictl customization get --org my-org my-org /dhi-golang " golang with git" --output my-customization.yaml
138+ docker dhi customization get my-org/dhi-golang " golang with git" --org my-org --output my-customization.yaml
125139
126140# Update a customization
127- dhictl customization edit --org my- org my-customization.yaml
141+ docker dhi customization edit my-customization.yaml -- org my-org
128142
129143# Delete a customization
130- dhictl customization delete --org my-org my-org/dhi-golang " golang with git"
144+ docker dhi customization delete my-org/dhi-golang " golang with git" --org my-org
145+
146+ # Delete without confirmation prompt
147+ docker dhi customization delete my-org/dhi-golang " golang with git" --org my-org --yes
131148```
132149
133- ### Enterprise Package Authentication {tier="DHI Enterprise"}
150+ ### Enterprise package authentication {tier="DHI Enterprise"}
134151
135152Generate authentication credentials for accessing the enterprise hardened
136153package repository. This is used when configuring your package manager to
@@ -139,42 +156,48 @@ instructions, see [Enterprise
139156repository] ( ./hardened-packages.md#enterprise-repository ) .
140157
141158``` bash
142- dhictl auth apk
159+ docker dhi auth apk
143160```
144161
145- ### Monitor Customization Builds {tier="DHI Select & DHI Enterprise"}
162+ ### Monitor customization builds {tier="DHI Select & DHI Enterprise"}
146163
147164List builds for a customization:
148165
149166``` bash
150- dhictl customization build list --org my-org my-org/dhi-golang " golang with git"
167+ docker dhi customization build list my-org/dhi-golang " golang with git" --org my-org
168+ docker dhi customization build list my-org/dhi-golang " golang with git" --org my-org --json
151169```
152170
153171Get details of a specific build:
154172
155173``` bash
156- dhictl customization build get --org my-org my-org/dhi-golang " golang with git" < build-id>
174+ docker dhi customization build get my-org/dhi-golang " golang with git" < build-id> --org my-org
175+ docker dhi customization build get my-org/dhi-golang " golang with git" < build-id> --org my-org --json
157176```
158177
159178View build logs:
160179
161180``` bash
162- dhictl customization build logs --org my-org my-org/dhi-golang " golang with git" < build-id>
181+ docker dhi customization build logs my-org/dhi-golang " golang with git" < build-id> --org my-org
182+ docker dhi customization build logs my-org/dhi-golang " golang with git" < build-id> --org my-org --json
163183```
164184
165- ### JSON Output
185+ ### JSON output
166186
167187Most list and get commands support a ` --json ` flag for machine-readable output:
168188
169189``` bash
170- dhictl catalog list --json
171- dhictl mirror list --org my-org --json
172- dhictl customization list --org my-org --json
190+ docker dhi catalog list --json
191+ docker dhi catalog get golang --json
192+ docker dhi mirror list --org my-org --json
193+ docker dhi mirror start --org my-org -r golang --json
194+ docker dhi customization list --org my-org --json
195+ docker dhi customization build list my-org/dhi-golang " golang with git" --org my-org --json
173196```
174197
175198## Configuration
176199
177- ` dhictl ` can be configured with a YAML file located at:
200+ The ` docker dhi ` CLI can be configured with a YAML file located at:
178201- ` $HOME/.config/dhictl/config.yaml ` on _ Linux_ and _ macOS_
179202- ` %USERPROFILE%\.config\dhictl\config.yaml ` on _ Windows_
180203
0 commit comments