Tools for helping use Container Registry.
Includes:
- Podman
- Skopeo
- RegClient (
regctl,regbot,regsync) - Crane (
crane,gcrane,krane)
Note: the following individual Images are also available from the Official Tool Developers
The main Motivation for this Docker/Podman/Container Image was to be able to:
- Use the Custom
registries.confConfiguration preferring Local Mirror on the Host - Use the Default
registries.confConfiguration using Stock Registries so that the Apps inside the Container can bypass the Local Mirror
Of course this also includes not having to install extra Tools on the Host 😃.
You need to first clone the Common https://github.com/luckylinux/container-build-tools somewhere in your System first, as I didn't want to over-complicate the Setup with git subtree or git submodule).
Then Symlink the Directory within this Repository to the "includes" Target:
git clone https://github.com/luckylinux/container-registry-tools
cd container-registry-tools
ln -s /path/to/container-build-tools includes
The Container can simply be built using:
./build.sh
Edit the Options to your liking.
The Container runs an Infinite Loop that can handle SIGTERM correctly.
This means that the Container can be stopped normally and without significant Delays.
# Set containerconfigfolder to default configuration in GitHub Repository
#containersconfigfolder="./containers"
# Set containerconfigfolder to somewhere that fits you (more permanent)
containersconfigfolder="${HOME}/.config/skopeo"
# Set a name for the Container
container="container-registry-tools"
# Run the Container
podman run -d --replace --rm --name=${name} --env-file "./.env" -v "${containersconfigfolder}:/etc/containers" "localhost/container-registry-tools:latest"
Enter the Container Shell (BASH):
podman exec -it "${name}" /bin/bash
Then perform the required Operation, as if you had those commands on the Host:
skopeo sync --scoped --src "docker" --dest "docker" --all "ghcr.io/home-assistant/home-assistant:stable" "${LOCAL_MIRROR}"
In this case, Docker/BASH Variable Expansion and single/double Quotes become a bit more Tricky.
# Execute Command
podman exec "${name}" bash -c "skopeo sync --scoped --src docker --dest docker --all \"ghcr.io/home-assistant/home-assistant:stable\" \"${LOCAL_MIRROR}\""
# Build Commands Args for use with Variable Expansion
eargs=()
eargs+=("--scoped")
eargs+=("--src")
eargs+=("docker")
eargs+=("--dest")
eargs+=("docker")
eargs+=("--all")
eargs+=("ghcr.io/home-assistant/home-assistant:stable")
eargs+=("${LOCAL_MIRROR}")
# Execute Command
podman exec "${name}" bash -c "skopeo sync ${eargs[*]}"