Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baseboxorg/c7277676059317a476e2 to your computer and use it in GitHub Desktop.
Save baseboxorg/c7277676059317a476e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
. /opt/elasticbeanstalk/hooks/common.sh
# Load ElasticBeanstalk environment variables
touch /tmp/env.sh
chmod 600 /tmp/env.sh
jq .docker.env[] $EB_CONFIG_FILE | tr -d \" > /tmp/env.sh
source /tmp/env.sh
rm /tmp/env.sh
# Start docker repository with name "registry"
docker run \
--name registry \
-e SETTINGS_FLAVOR=prod \
-e DOCKER_REGISTRY_CONFIG=/docker-registry/config/config_sample.yml \
-e AWS_BUCKET=$DOCKER_REPOSITORY_BUCKET \
-e STORAGE_PATH=/ \
-e AWS_KEY=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET=$AWS_SECRET_KEY \
-e SEARCH_BACKEND=sqlalchemy \
-p 49000:5000 -d \
registry docker-registry
nRetry=0
while [[ $((nRetry++)) < 3 ]]; do
echo "Checking if the registry is up..."
sleep 5
RET=`curl http://127.0.0.1:49000/v1/_ping 2>1 /dev/null`
if [[ $RET == "true" ]]; then
echo "Registry container is up"
exit 0
fi
done
echo "Failed to launch registry container"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment