THRIFT-3690 Work around docker image build failures on Travis-CI
Client: Build
Patch: Nobuaki Sukegawa

This closes #906
diff --git a/.travis.yml b/.travis.yml
index 7aa6efb..51e9f47 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,9 +25,9 @@
   - docker
 
 install:
-  - docker pull thrift/$DISTRO:latest || true
+  - travis_wait docker pull thrift/$DISTRO:latest || true
   - cp -r ./build/docker/scripts/*.sh ./build/docker/$DISTRO/scripts/
-  - docker build -q -t thrift-build build/docker/$DISTRO
+  - travis_wait travis_retry docker build -q -t thrift-build build/docker/$DISTRO
 
 script:
   - docker run $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build $BUILD_CMD $BUILD_ARG
diff --git a/build/docker/scripts/autotools.sh b/build/docker/scripts/autotools.sh
index 4c111e6..8388f72 100755
--- a/build/docker/scripts/autotools.sh
+++ b/build/docker/scripts/autotools.sh
@@ -3,4 +3,4 @@
 
 ./bootstrap.sh
 ./configure $*
-make check -j4
+make check -j3
diff --git a/build/docker/scripts/cmake.sh b/build/docker/scripts/cmake.sh
index 8204a1d..0b92c5b 100755
--- a/build/docker/scripts/cmake.sh
+++ b/build/docker/scripts/cmake.sh
@@ -3,6 +3,6 @@
 
 mkdir -p cmake_build && cd cmake_build
 cmake $* ..
-make -j4
+make -j3
 cpack
 ctest -VV -E "(concurrency_test|processor_test)"
diff --git a/build/docker/scripts/cross-test.sh b/build/docker/scripts/cross-test.sh
index d9562ab..4da7813 100755
--- a/build/docker/scripts/cross-test.sh
+++ b/build/docker/scripts/cross-test.sh
@@ -3,7 +3,7 @@
 
 ./bootstrap.sh
 ./configure --enable-tutorial=no
-make -j4 precross
+make -j3 precross
 
 set +e
 make cross