Forked from kntyskw/start_docker_registry_on_eb.sh
Last active
August 29, 2015 14:06
-
-
Save baseboxorg/c7277676059317a476e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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