Skip to content

luckylinux/container-registry-tools

Repository files navigation

Introduction

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

Motivation

The main Motivation for this Docker/Podman/Container Image was to be able to:

  • Use the Custom registries.conf Configuration preferring Local Mirror on the Host
  • Use the Default registries.conf Configuration 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 😃.

Setup

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

Build

The Container can simply be built using:

./build.sh

Edit the Options to your liking.

Usage

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"

Interactive Command Execution

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}"

Non-Interactive Command Execution

In this case, Docker/BASH Variable Expansion and single/double Quotes become a bit more Tricky.

Using Quote Escaping

# Execute Command
podman exec "${name}" bash -c "skopeo sync --scoped --src docker --dest docker --all \"ghcr.io/home-assistant/home-assistant:stable\" \"${LOCAL_MIRROR}\""

Using Variable Expansion

# 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[*]}"

About

Tools for helping use Container Registry

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages