Scripts for periodical pulling images from hub.docker.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
554 B

  1. #!/bin/bash
  2. imagesFile=$1
  3. function getImageTags {
  4. image="$1"
  5. tags=`wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'`
  6. if [ -n "$2" ]
  7. then
  8. tags=` echo "${tags}" | grep "$2" `
  9. fi
  10. echo "${tags}"
  11. }
  12. for image in $(cat ${imagesFile});
  13. do
  14. for tag in $(getImageTags ${image});
  15. do
  16. # remove image from local cache to force pull
  17. docker rmi ${image}:${tag}
  18. docker pull ${image}:${tag}
  19. done;
  20. done;