Skip to content

Instantly share code, notes, and snippets.

@quickmute
Last active January 3, 2022 04:26
Show Gist options
  • Save quickmute/5bee93a4f5176c0ed0e7b6979ba8df54 to your computer and use it in GitHub Desktop.
Save quickmute/5bee93a4f5176c0ed0e7b6979ba8df54 to your computer and use it in GitHub Desktop.
Run inotifywait to update ecr
#!/bin/sh
# get Docker Root Director
DOCKERROOT=`docker info | grep 'Docker Root Dir' | awk -F ": " '{print $2}'`
# Append the image SHA256 to the above path, this is where the new images go
IMAGEMETADATA="$DOCKERROOT/image/overlay2"
# create a notify event on this dir, specifically we are watching repositories.json file
sudo inotifywait -m -e moved_to $IMAGEMETADATA \
| while read FILENAME
do
/home/ubuntu/update_ecr.sh
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment