Hangar

Hangar is a tool for mirroring/copying multi-arch container images from the public registry to your registry with manifest list support, it also can generate an image list file according to Rancher KDM data and chart repositories for mirroring/saving images.
It provides the following subcommands:
- mirror: mirror images from the source registry to your own registry according to the image list file.
- save: download the image locally and generate a compressed package according to the image list file.
- load: load images from the compressed package and upload them to the personal registry.
- convert-list: convert image list to 'mirror' format.
- mirror-validate: validate the mirrored images.
- load-validate: validate the loaded images.
- generate-list: generate an image-list by Rancher KDM data and Chart repositories.
Dependencies
Hangar uses skopeo to copy container images and use docker client and docker-buildx to build the manifest list.
Docs
For more detailed usage information about this project, please refer to the documents in docs folder.
English | 简体中文-使用文档
QuickStart
It's recommended to run hangar
from the docker image without installing skopeo
and docker-buildx
dependencies manually.
$ docker pull cnrancher/hangar:${VERSION}
$ docker run cnrancher/hangar:${VERSION} --help
Usage: hangar COMMAND [OPTIONS]
......
$ docker run --entrypoint bash -v $(pwd):/images -it cnrancher/hangar:${VERSION}
Or you can download the latest compiled binary file hangar-${OS}-${ARCH}-${VERSION}
from the Release page.
# Download hangar binary file from GitHub Release
wget https://github.com/cnrancher/hangar/releases/download/<VERSION>/hangar-<OS>-<ARCH>-<VERSION> -O hangar
chmod +x ./hangar
# Get help message
./hangar -h
Build
# Ensure Docker and make are installed
# Get help message
make help
# Build binary files into `build` folder
make build
# Run unit test
make test
# Delete binary files
make clean
LICENSE
Copyright 2022-2023 Rancher Labs, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.