Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Pull down the latest docker images
- #
- # "docker-compose pull" will pull down the latest images but will not do it
- # intelligently as it will attempt to update things multiple times if they
- # are dependencies of several services (eg. mysql).
- #
- # It will also only work on the current directory.
- #
- # This script will:
- # - Only attempt to update an image *once*.
- # - Process all the docker-compose.yml files in the given directory and
- # all subdirectories.
- if [ "$#" -ne 1 ] || ! [ -d "$1" ]; then
- echo "Usage: $0 [directory]" >&2
- exit 1
- fi
- cd $1
- # Find all non-vendor docker-compose.yml files.
- files=$(find . -name docker-compose.yml | egrep -v 'vendor|node_modules')
- # Pull out the images used
- # Have to filter out "image: {ecr}/{repo}:{tag}"
- images=$(grep -h image: $files | grep -v '{' | awk '{ print $2 }' | sort | uniq)
- # Now do the update
- for image in $images
- do
- docker pull $image
- done
Add Comment
Please, Sign In to add comment