Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Downloads docker registry container image archive from the bucket specified by environment variable DOCKER_REGISTRY_BUCKET and import it to docker.
# Check if the registry image is already installed
IS_INSTALLED=`docker images | grep -E 'registry\s*latest' | wc -l`
if [ $IS_INSTALLED == 0 ]; then
. /opt/elasticbeanstalk/hooks/
# Load ElasticBeanstalk environment variables
touch /tmp/
chmod 600 /tmp/
jq .docker.env[] $EB_CONFIG_FILE | tr -d \" > /tmp/
source /tmp/
rm /tmp/
echo "Downloading registry image"
aws s3 cp s3://$DOCKER_REPOSITORY_BUCKET/registry-image.tgz /tmp/registry-image.tgz
echo "Installing registry image"
cat /tmp/registry-image.tgz | docker import - registry:latest
echo "registry image has been installed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment