A tool to copy/sync images in registries without a demon.
imagesync -h
NAME:
imagesync - Sync images in registries.
USAGE:
imagesync [global options] command [command options] [arguments...]
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--src value, -s value Reference for the source container image/repository.
--src-strict-tls Enable strict TLS for connections to source container registry.
--dest value, -d value Reference for the destination container repository.
--dest-strict-tls Enable strict TLS for connections to destination container registry.
--tags-pattern value Regex pattern to select for tag to-be synced.
--skip-tags-pattern value Regex pattern to exclude tags.
--skip-tags value Comma separated list of tags to be skipped.
--overwrite Use this to copy/override all the tags.
--max-concurrent-tags value Maximum number of tags to be synced/copied in parallel. (default: 1)
--help, -h show help
You can download the binary from releases page and use it directly:
VERSION=$(curl -s https://api.github.com/repos/mqasimsarfraz/imagesync/releases/latest | jq -r .tag_name)
curl -sL https://github.com/mqasimsarfraz/imagesync/releases/download/${VERSION}/imagesync_Linux_x86_64.tar.gz | sudo tar -C /usr/local/bin -xzf - imagesync
imagesync -h
You can use the docker image to run imagesync
:
VERSION=$(curl -s https://api.github.com/repos/mqasimsarfraz/imagesync/releases/latest | jq -r .tag_name)
docker run --rm -it ghcr.io/mqasimsarfraz/imagesync:$VERSION -h
Following is a list of examples with different sources. In order to try out examples with testdata you need to start a local registry using:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
imagesync -s testdata/alpine.tar -d localhost:5000/library/alpine:3
imagesync -s testdata/alpine-oci.tar -d localhost:5000/library/alpine:3
imagesync -s testdata/alpine-oci -d localhost:5000/library/alpine:3
imagesync -s library/alpine:3 -d localhost:5000/library/alpine:3
imagesync -s ghcr.io/nginxinc/charts/nginx-ingress:1.3.1 -d localhost:5000/nginxinc/charts/nginx-ingress:1.3.1
imagesync -s library/alpine -d localhost:5000/library/alpine
imagesync -s ghcr.io/nginxinc/charts/nginx-ingress -d localhost:5000/nginxinc/charts/nginx-ingress
imagesync
will respect the credentials stored in ~/.docker/config.json
via docker login
etc. So in case you are
running it in a container you need to mount the path with credentials as:
docker run --rm -it -v ${HOME}/.docker/config.json:/root/.docker/config.json ghcr.io/mqasimsarfraz/imagesync:v1.2.0 -h
imagesync
supports copying multi-arch images. So in case you are copying a multi-arch image it will copy all the platforms unlike docker pull
/docker push
approach which only copies the platform of the host.
Following needs to be installed in order to compile the project locally:
dnf --enablerepo=powertools install gpgme-devel
dnf install libassuan libassuan-devel
sudo apt install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config