Browse Source

Merge pull request #2441 from infosiftr/no-such-image

Fix "No such image, container or task" for "docker-build.sh" when the "FROM" does not exist yet
Tianon Gravi 9 years ago
parent
commit
3fb5fe9f8a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      test/tests/docker-build.sh

+ 4 - 0
test/tests/docker-build.sh

@@ -24,6 +24,10 @@ trap "rm -rf '$tmp'" EXIT
 cat > "$tmp/Dockerfile"
 
 from="$(awk -F '[ \t]+' 'toupper($1) == "FROM" { print $2; exit }' "$tmp/Dockerfile")"
+if ! docker inspect "$from" &> /dev/null; then
+	docker pull "$from" > /dev/null
+fi
+
 onbuilds="$(docker inspect -f '{{len .Config.OnBuild}}' "$from")"
 if [ "$onbuilds" -gt 0 ]; then
 	# crap, the image we want to build has some ONBUILD instructions