Skip to content

Instantly share code, notes, and snippets.

@WesselAtWork
Created January 2, 2024 13:21
Show Gist options
  • Select an option

  • Save WesselAtWork/9f3d66a7bae302af4ffca949d3f51b2b to your computer and use it in GitHub Desktop.

Select an option

Save WesselAtWork/9f3d66a7bae302af4ffca949d3f51b2b to your computer and use it in GitHub Desktop.
Logs In Ephemerally and then pulls [ARGS] images from ECR. Assumes all [ARGS] can use the same creds as the 1st ARG.
#!/bin/bash
URL="$1"
REGISTRY="${URL%/*}"
pre="${REGISTRY%.amazonaws.com}"
AWS_REGION="${pre##*.}"
HOME="."
export HOME
aws ecr get-login-password --region "$AWS_REGION" | oras login --username AWS --password-stdin "$REGISTRY"
printf '%s\0' "$@" | xargs -n1 --null oras pull
unset HOME
rm -rf .docker .containers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment