File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # # this simple script checks if you have docker images stored as tar archives
4+ # # if so - it will load it from there, if not - it will pull and save it there
5+ # # useful for circle images caching:
6+ # # https://circleci.com/docs/docker#caching-docker-layers
7+
8+ cache_dir=~ /cache_docker_images/
9+ mkdir -p $cache_dir
10+ for image in ` cat docker-compose.yml | grep ' image:' | grep -o ' [^ ]*$' ` ; do
11+ filename=$( echo " $image " | sed -r ' s/\//_/g' )
12+
13+ image_path=" $cache_dir " " $filename " " .tar"
14+
15+ if [[ -e $image_path ]]; then
16+ echo " Image $image exists in $image_path , loading..."
17+ docker load -i $image_path
18+ else
19+ echo " Image $image not found, pulling..."
20+ docker pull $image
21+ echo " saving $image > $image_path "
22+ docker save $image > $image_path
23+ fi
24+
25+ done
You can’t perform that action at this time.
0 commit comments