Skip to main content
Version: v1.6

Hangar Tutorial

Commands

  • mirror: Mirror container images between image registries.
  • save: Download the container image to the local file and generate a compressed package.
  • load: Load the file created by save command onto the private registry.
  • convert-list: Convert image list from rancher-images.txt to format used by mirror command.
  • mirror-validate: Validate the mirrored image.
  • load-validate: Validate the loaded image.
  • sync: Sync extra images into image cache folder.
  • compress: Compress the image cache folder.
  • decompress: Decompress tarball created by save command.
  • generate-list: Generate an image-list by KDM data and Chart repositories.

Supported Registries

  • Docker Hub
  • Harbor V2

    Hangar does not support Harbor V1 registry

  • Public cloud platforms: Tencent Cloud TCR, Alibaba Cloud ACR, etc

Environment

Hangar supports running in container, see docker-images.

To install hangar in your system, please install skopeo dependency:

  1. Linux / macOS, architecture amd64 / arm64

  2. Install skopeo

  3. Set environment variables (optional):

    When running Mirror / Save / Load, following environment variables sets the username, password and URL of the source / destination registry (used in CI scenario).

    • SOURCE_USERNAME: Source registry username

    • SOURCE_PASSWORD: Source registry password

    • SOURCE_REGISTRY: Source registry address

    • DEST_USERNAME: Destination registry username

    • DEST_PASSWORD: Destination registry password

    • DEST_REGISTRY: Destination registry address

    If not specifying username / password, hangar will also try to obtain the username and password of the registry from the ~/.docker/config.json file.

    If the user name and password are not set, hangar will prompt to enter the user name and password manually.

  4. When the registry server is HTTP or using a self-signed insecure SSL Certificate, you can add --tls-verify=false global option to skip tls verify.

Tests

See test docs.

FAQ

FAQ

Build

The stable release can be obtained from the Releases page.

Build executable binaries: build