Skip to content

Instantly share code, notes, and snippets.

@dlbewley
Created November 2, 2022 22:34
Show Gist options
  • Save dlbewley/ae1d678300db47cfcee8ec141385eb22 to your computer and use it in GitHub Desktop.
Save dlbewley/ae1d678300db47cfcee8ec141385eb22 to your computer and use it in GitHub Desktop.
Podman login to all registries in pull secret
# if you don't want to just use --authfile or set REGISTRY_AUTH_FILE for whatever reason
# you may login to each registry in your pull secret thusly
# spoiler alert, here's how to extract usernames and passwords from your pull secret
PULL_SECRET_PATH=pull-secret.json
for R in $(jq -r '.auths|keys[]' $PULL_SECRET_PATH ); do
echo "Logging into $R"
U=$(jq -r ".auths.\"$R\".auth" $PULL_SECRET_PATH | base64 -d | awk -F: '{print $1}')
P=$(jq -r ".auths.\"$R\".auth" $PULL_SECRET_PATH | base64 -d | awk -F: '{print $2}')
podman login -u $U -p $P $R
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment