goharbor/harbor-cli(新しいタブで開きます)
主要言語: Go
Official Harbor CLI
- star 数
- 167
- watcher 数
- 7
- fork 数
- 216
- issue 数
- 155
- 最終更新
- 2026/10/28
主要言語: Go
Official Harbor CLI
Harbor CLI — a command-line interface for interacting with your Harbor container registry. A streamlined, user-friendly alternative to the WebUI, as your daily driver or for scripting and automation.
The project's first goal is to reach WebUI parity.
✅ project Manage projects
✅ repo Manage repositories
✅ artifact Manage artifacts
✅ label Manage labels
✅ tag Manage tags
✅ quota Manage quotas
✅ webhook Manage webhook policies
✅ robot Robot Account
✅ login Log in to Harbor registry
✅ user Manage users
✅ registry Manage registries
✅ replication Manage replication
✅ config Manage the config of the Harbor CLI
✅ cve-allowlist Manage system CVE allowlist
✅ health Get the health status of Harbor components
✅ preheat Manage preheat provider instances
✅ info Display detailed Harbor system, statistics, and CLI environment information
✅ Scanner scanner commands CRUD
✅ schedule Schedule jobs in Harbor
✅ vulnerability List and view vulnerability summary from Harbor Security Hub
❌ Distribution
❌ GC
❌ Job Service Dashboard
❌ Auditlog Auditlogs dashboard
✅ completion Generate the autocompletion script for the specified shell
✅ help Help about any command
✅ version Version of Harbor CLI
For additional artifacts like archives, checksums and SBOMs, refer to the releases page.
Running Harbor CLI as a container is simple. Use the following command to get started:
docker run -ti --rm -v $HOME/.config/harbor-cli:/root/.config/harbor-cli \ -e HARBOR_ENCRYPTION_KEY=$(echo "ThisIsAVeryLongPassword" | base64) \ registry.goharbor.io/harbor-cli/harbor-cli \ --help
Use the HARBOR_ENCRYPTION_KEY container environment variable as a base64-encoded 32-byte key for AES-256 encryption. This securely stores your harbor login password.
If you intend to run the CLI as a container, it is advised to set the following environment variables and to create an alias and append the alias to your .zshrc or .bashrc file
echo "export HARBOR_CLI_CONFIG=\$HOME/.config/harbor-cli" >> ~/.zshrc echo "export HARBOR_ENCRYPTION_KEY=\$(cat <path_to_32bit_private_key_file> | base64)" >> ~/.zshrc echo "alias harbor='docker run -ti --rm -v \$HARBOR_CLI_CONFIG:/root/.config/harbor-cli -e HARBOR_ENCRYPTION_KEY=\$HARBOR_ENCRYPTION_KEY registry.goharbor.io/harbor-cli/harbor-cli'" >> ~/.zshrc source ~/.zshrc # or restart your terminal
brew install harbor-cli
Replace
<version>with the desired release version (e.g., v0.x.x).
wget https://github.com/goharbor/harbor-cli/releases/download/<version>/harbor-cli_<version>_linux_amd64.deb sudo dpkg -i harbor-cli_<version>_linux_amd64.deb
wget https://github.com/goharbor/harbor-cli/releases/download/<version>/harbor-cli_<version>_linux_amd64.rpm sudo rpm -i harbor-cli_<version>_linux_amd64.rpm
wget https://github.com/goharbor/harbor-cli/releases/download/<version>/harbor-cli_<version>_linux_amd64.apk sudo apk add --allow-untrusted harbor-cli_<version>_linux_amd64.apk
echo "deb [trusted=yes] https://harborcli.goharbor.io stable main" | sudo tee /etc/apt/sources.list.d/harbor-cli.list sudo apt update sudo apt install harbor-cli
Using Curl or Wget isn't needed if you want to add the Harbor CLI to your container. Instead, we recommend copying the Harbor CLI from our official image by using the following Dockerfile:
#... COPY --from=registry.goharbor.io/harbor-cli/harbor-cli:latest /harbor /usr/local/bin/harbor # --chown and --chmod flags can be used to set the permissions
>./harbor Official Harbor CLI Usage: harbor [command] Examples: // Base command: harbor // Display help about the command: harbor help Available Commands: artifact Manage artifacts completion Generate the autocompletion script for the specified shell config Manage the config of the Harbor CLI cve-allowlist Manage system CVE allowlist health Get the health status of Harbor components help Help about any command info Show the current credential information instance Manage preheat provider instances in Harbor label Manage labels in Harbor login Log in to Harbor registry project Manage projects and assign resources to them registry Manage registries repo Manage repositories schedule Schedule jobs in Harbor tag Manage tags in Harbor registry user Manage users version Version of Harbor CLI Flags: -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) -h, --help help for harbor -o, --output-format string Output format. One of: json|yaml -v, --verbose verbose output Use "harbor [command] --help" for more information about a command.
Use the --config flag to specify a custom configuration file path (the highest priority).
harbor --config /path/to/custom/config.yaml artifact list
If --config is not provided, Harbor CLI checks the HARBOR_CLI_CONFIG environment variable for the config file path.
export HARBOR_CLI_CONFIG=/path/to/custom/config.yaml
harbor artifact listIf neither is set, it defaults to $XDG_CONFIG_HOME/harbor-cli/config.yaml or $HOME/.config/harbor-cli/config.yaml if XDG_CONFIG_HOME is unset.
harbor artifact list
XDG_DATA_HOME environment variable.XDG_DATA_HOME is not set, it defaults to $HOME/.local/share/harbor-cli/data.yaml.--config flag > HARBOR_CLI_CONFIG environment variable > default XDG config paths.--config flag takes precedence over both environment variables and defaults.harbor login demo.goharbor.io -u harbor-cli -p Harbor12345
harbor project create
harbor project list
# output
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│ Project Name Access Level Type Repo Count Creation Time │
│ ──────────────────────────────────────────────────────────────────────────────────────── │
│ library public project 0 1 hour ago │
└──────────────────────────────────────────────────────────────────────────────────────────┘harbor repo list
# output
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ Name Artifacts Pulls Last Modified Time │
│ ────────────────────────────────────────────────────────────────────────────────────── │
│ library/harbor-cli 1 0 0 minute ago │
└────────────────────────────────────────────────────────────────────────────────────────┘| Platform | Status |
|---|---|
| Linux | ✅ |
| macOS | ✅ |
| Windows | ✅ |
Make sure you have the latest Dagger installed in your system.
git clone https://github.com/goharbor/harbor-cli.git && cd harbor-cli dagger call build-dev --platform darwin/arm64 export --path=./harbor-cli ./harbor-dev --help
If golang is installed in your system, you can also build the project using the following commands:
git clone https://github.com/goharbor/harbor-cli.git && cd harbor-cli go build -o harbor-cli cmd/harbor/main.go
At the moment, the Harbor CLI is developed and tested with Harbor 2.13. The CLI should work with versions prior to 2.13, but not all functionalities may be available or work as expected.
Harbor <2.0.0 is not supported.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
This project is maintained by the Harbor community. We thank all our contributors and users for their support.
For any questions or issues, please open an issue on our GitHub Issues page.
Give a ⭐ if this project helped you, Thank YOU!