Skip to content

Althaf66/harbor-cli

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

harbor-3

Welcome to the Harbor CLI project! This powerful command-line tool facilitates seamless interaction with the Harbor container registry. It simplifies various tasks such as creating, updating, and managing projects, registries, and other resources in Harbor.

Artifact Hub

Project Scope πŸ§ͺ

The Harbor CLI is designed to enhance your interaction with the Harbor container registry. Built on Golang, it offers a user-friendly interface to perform various tasks related to projects, registries, and more. Whether you're creating, updating, or managing resources, the Harbor CLI streamlines your workflow efficiently.

Project Features 🀯

πŸ”Ή Get details about projects, registries, repositories and more
πŸ”Ή Create new projects, registries, and other resources
πŸ”Ή Delete projects, registries, and other resources
πŸ”Ή Run commands with various flags for enhanced functionality
πŸ”Ή More features coming soon... 🚧

Installation

Container

It is straightforward to use the Harbor CLI as a container. You can run the following command to use the Harbor CLI as a container:

docker run -ti --rm -v $HOME/.harbor/config.yaml:/root/.harbor/config.yaml registry.goharbor.io/harbor-cli/harbor-cli --help

Add the following command to create an alias and append the alias to your .zshrc or .bashrc file

echo "alias harbor='docker run -ti --rm -v \$HOME/.harbor/config.yaml:/root/.harbor/config.yaml registry.goharbor.io/harbor-cli/harbor-cli'" >> ~/.zshrc
source ~/.zshrc # or restart your terminal

Linux, MacOS and Windows

Harbor CLI will soon be published on Homebrew. Meantime, we recommend using Harbor in the Container or download the binary from the releases page

Add the Harbor CLI to your Container Image

Using Curl or Wget isn't recommended for adding 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

Example CommandsπŸ’‘

>./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
  health      Get the health status of Harbor components
  help        Help about any command
  login       Log in to Harbor registry
  project     Manage projects and assign resources to them
  registry    Manage registries
  repo        Manage repositories
  user        Manage users
  version     Version of Harbor CLI

Flags:
      --config string          config file (default is $HOME/.harbor/config.yaml) (default "/Users/vadim/.harbor/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.

Log in to Harbor Registry

harbor login demo.goharbor.io -u harbor-cli -p Harbor12345

Create a New Project

harbor project create

List all Projects

harbor project list

# output
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Project Name  Access Level  Type          Repo Count    Creation Time                   β”‚
β”‚ ──────────────────────────────────────────────────────────────────────────────────────── β”‚
β”‚  library       public        project       0             1 hour ago                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

List all Repository in a Project

harbor repo list

# output
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Name                      Artifacts     Pulls         Last Modified Time              β”‚
β”‚ ────────────────────────────────────────────────────────────────────────────────────── β”‚
β”‚  library/harbor-cli        1             0             0 minute ago                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Supported Platforms

Platform Status
Linux βœ…
macOS βœ…
Windows βœ…

Build From Source

Make sure you have latest Dagger installed in your system.

Using Dagger

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
go build -o harbor-cli cmd/harbor/main.go

Version Compatibility With Harbor

At the moment, the Harbor CLI is developed and tested with Harbor 2.11. The CLI should work with versions prior to 2.11, but not all functionalities may be available or work as expected.

Harbor <2.0.0 is not supported.

Community

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Acknowledgements

This project is maintained by the Harbor community. We thank all our contributors and users for their support.

❀️ Show your support

For any questions or issues, please open an issue on our GitHub Issues page.
Give a ⭐ if this project helped you, Thank YOU!

About

[Sandbox] Official Harbor CLI

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%