diff --git a/scripts/save_docker_cache.sh b/scripts/save_docker_cache.sh index 03d0976..4f5dc59 100755 --- a/scripts/save_docker_cache.sh +++ b/scripts/save_docker_cache.sh @@ -23,7 +23,8 @@ set -o pipefail if [[ ${TRAVIS_BRANCH} == "master" ]] && [[ ${TRAVIS_PULL_REQUEST} == "false" ]]; then - mkdir -p $(dirname ${DOCKER_CACHE_FILE}); - docker save $(docker history -q cartographer_ros:${ROS_RELEASE} | - grep -v '') | gzip > ${DOCKER_CACHE_FILE}; + mkdir -p $(dirname ${DOCKER_CACHE_FILE}) + IMAGE_NAMES=$(docker history -q cartographer_ros:${ROS_RELEASE} | grep -v '') + docker save ${IMAGE_NAMES} | gzip > ${DOCKER_CACHE_FILE}.new + mv ${DOCKER_CACHE_FILE}.new ${DOCKER_CACHE_FILE} fi