Skip to content

Instantly share code, notes, and snippets.

Last active January 3, 2016 13:40
  • Star 1 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kntyskw/c9ec984b18249272f7e4 to your computer and use it in GitHub Desktop.
Starts private docker repository backed by S3 on ElasticBeanstalk environment. It is supposed to launch before the application container is launched so that the application container image can be pulled from the local private repository.
. /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/
# Start docker repository with name "registry"
docker run \
--name registry \
-e DOCKER_REGISTRY_CONFIG=/docker-registry/config/config_sample.yml \
-e SEARCH_BACKEND=sqlalchemy \
-p 49000:5000 -d \
registry docker-registry
while [[ $((nRetry++)) < 3 ]]; do
echo "Checking if the registry is up..."
sleep 5
RET=`curl 2>1 /dev/null`
if [[ $RET == "true" ]]; then
echo "Registry container is up"
exit 0
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