Basics
The application consists of several top-level commands pertaining to specific Harbor resources, such as project
, repository
, artifact
, etc. Each of these commands have subcommands that can be used to perform actions on the resource, such as create
, delete
, list
, etc.
See Actions terminology for more information about the semantics of the different actions.
Command
A command is typically invoked as follows:
project
is the resource type, and list
is the action to perform on the resource, and together they form the command. Most commands are namespaced in this way, where a resource type has one or more actions associated with it. Some command even have subsubcommands, such as:
For more information about how command names are structured, see Terminology.
Arguments
Commands sometimes take one or more positional arguments:
The command artifact tag create
takes two positional arguments:
library/hello-world:latest
- The artifact to tagmy-tag
- The name of the tag to create
These are positional arguments, which means the order in which they are specified is important.
Argument types
The expected type of an argument is specified in the command's documentation. The following types are used:
text
A text string. Can be any sequence of characters. Enclose in quotes if it contains spaces.
integer
A whole number without a decimal point. Unconstrained unless otherwise specified in the command's help text.
boolean
A boolean value. Can be true
, false
, 1
, or 0
. Case-insensitive.
Info
A boolean argument is typically used for resources whose value can be None
, True
or False
.
choice
A choice between a set of values. The valid values are specified in the help text for the command.
Options
Most commands also have a number of options that can be specified. In certain cases at least one option is required, such as when updating a project with project update
:
Since we are updating a resource, we are expected to specify at least one field to update. In this case we set --public
to false
, making the project private.
Multiple values
Certain options accept multiple values. These can be specified as a comma-separated list:
Or by using the relevant option multiple times:
Flags
Some options are flags, meaning they do not take any arguments. Flags are specified as follows:
Flags can be inverted by prefixing the flag name with no-
:
Info
Flags are typically used to toggle a certain behavior. For example, the --public
flag for project list
can be used to list only public projects.
Global options
Global options are options that apply to all commands. They must be specified before the command. Examples of these are --config
, --url
and --username
.
Global options must be specified before the command to run, e.g.:
See the Options page for more information on the available global options.
Help
For more information about a specific command, use:
See Commands for more in-depth information about how to use the various commands.
Search for commands
To search for a command based on name or description, use:
See harbor find
for more information.
Help output
The output of harbor --help
shows all the available commands and command groups along with the global options:
$ harbor --help
Usage: harbor [OPTIONS] COMMAND [ARGS]...
Harbor CLI
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --config -c PATH Path to config file. │
│ --version Show application │
│ version and exit. │
│ --install-completion [bash|zsh|fish|powers Install completion for │
│ hell|pwsh] the specified shell. │
│ [default: None] │
│ --show-completion [bash|zsh|fish|powers Show completion for the │
│ hell|pwsh] specified shell, to │
│ copy it or customize │
│ the installation. │
│ [default: None] │
│ --help Show this message and │
│ exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Harbor ─────────────────────────────────────────────────────────────────────╮
│ --url,--harbor-url -u TEXT Harbor API URL. │
│ Overrides config │
│ option harbor.url. │
│ --username,--harbor-… -U TEXT Harbor username. │
│ Overrides config │
│ option │
│ harbor.username. │
│ --secret,--harbor-se… -S TEXT Harbor secret │
│ (password). Overrides │
│ config option │
│ harbor.secret. │
│ --basicauth -B TEXT Harbor basic access │
│ credentials (base64). │
│ Overrides config │
│ option │
│ harbor.basicauth. │
│ --credentials-file -F PATH Path to Harbor JSON │
│ credentials file. │
│ Overrides config │
│ option │
│ harbor.credentials_f… │
│ --validate --no-validate Validate Harbor API │
│ response data. Forces │
│ JSON output format if │
│ disabled. Overrides │
│ config option │
│ harbor.validate_data. │
│ --raw --no-raw Return raw data from │
│ Harbor API. Overrides │
│ all output formatting │
│ options. Overrides │
│ config option │
│ harbor.raw_mode. │
│ --verify-ssl --no-verify-ssl Verify SSL │
│ certificates when │
│ connecting to Harbor. │
│ Overrides config │
│ option │
│ harbor.verify_ssl. │
│ --retry --no-retry Retry failed HTTP │
│ requests. Overrides │
│ config option │
│ harbor.retry.enabled. │
│ --retry-max-tries INTEGER Number of times to │
│ retry failed HTTP │
│ requests. Overrides │
│ config option │
│ harbor.retry.max_tri… │
│ --retry-max-time FLOAT Maximum number of │
│ seconds to retry │
│ failed HTTP requests. │
│ Overrides config │
│ option │
│ harbor.retry.max_tim… │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Output ─────────────────────────────────────────────────────────────────────╮
│ --table-descripti… --no-table-desc… Include field │
│ descriptions in │
│ tables. Overrides │
│ config option │
│ output.table.desc… │
│ --table-max-depth INTEGER Maximum depth to │
│ print nested │
│ objects in tables. │
│ Overrides config │
│ option │
│ output.table.max_… │
│ --table-compact --no-table-comp… Compact table │
│ output. Has no │
│ effect on other │
│ formats. Overrides │
│ config option │
│ output.table.comp… │
│ --json-indent INTEGER Indentation level │
│ for JSON output. │
│ Overrides config │
│ option │
│ output.json.inden… │
│ --json-sort-keys --no-json-sort-… Sort keys in JSON │
│ output. Overrides │
│ config option │
│ output.json.sort_… │
│ --format -f [table|json] Specifies the │
│ output format to │
│ use. Overrides │
│ config option │
│ output.format. │
│ --paging --no-paging Display output in │
│ a pager (less, │
│ etc.). Overrides │
│ config option │
│ output.paging. │
│ --pager TEXT Pager command to │
│ use. The default │
│ Rich pager will be │
│ used. Overrides │
│ config option │
│ output.pager. │
│ --output -o PATH Output file, by │
│ default None, │
│ which means output │
│ to stdout. If the │
│ file already │
│ exists, it will be │
│ overwritten. │
│ --no-overwrite Do not overwrite │
│ the output file if │
│ it already exists. │
│ --verbose -v Enable verbose │
│ output. │
│ --with-stdout Output to stdout │
│ in addition to the │
│ specified output │
│ file, if any. Has │
│ no effect if no │
│ output file is │
│ specified. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Confirmation & Alerts ──────────────────────────────────────────────────────╮
│ --confirm-deletion --no-confirm-deletion Confirm before deleting │
│ resources. Overrides │
│ config option │
│ general.confirm_deleti… │
│ --confirm-enumeration --no-confirm-enumerat… Confirm before │
│ enumerating all │
│ resources without a │
│ limit or query. │
│ Overrides config option │
│ general.confirm_enumer… │
│ --warnings --no-warnings Show/hide warnings. │
│ Overrides config option │
│ general.warnings. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ artifact Manage artifacts. │
│ auditlog Audit log management and access │
│ commands List all commands. │
│ config Manage Harbor configuration. │
│ cve-allowlist Manage the system-wide CVE allowlist. │
│ find Search for commands based on names and descriptions. │
│ gc Garbage Collection scheduling and information │
│ init Initialize Harbor CLI configuration file. │
│ ldap LDAP configuration │
│ project Manage projects. │
│ quota Quota management │
│ registry Registry management │
│ repl Start an interactive REPL. │
│ replication Registry replication execution and policy. │
│ repository Manage repositories. │
│ retention Artifact retention policy management and execution. │
│ sample-config Print a sample config file to stdout. │
│ scan Scanning of individual artifacts. │
│ scan-all Scanning of all artifacts. │
│ scanner Manage scanners. │
│ search Search for projects and repositories. │
│ self Manage the CLI itself. │
│ system System information │
│ tui Start a TUI (text-based user interface). │
│ user Manage users. │
│ usergroup Manage user groups. │
│ webhook Manage webhooks │
╰──────────────────────────────────────────────────────────────────────────────╯