diff --git a/src/docker.js b/src/docker.js index eb63af7b6..84206a9bb 100644 --- a/src/docker.js +++ b/src/docker.js @@ -143,6 +143,7 @@ function pullImage(manifest, callback) { debug(`pullImage: will pull ${manifest.dockerImage}. auth: ${authConfig ? 'yes' : 'no'}`); gConnection.pull(manifest.dockerImage, { authconfig: authConfig }, function (error, stream) { + if (error && error.statusCode === 404) return callback(new BoxError(BoxError.NOT_FOUND, `Unable to pull image ${manifest.dockerImage}. message: ${error.message} statusCode: ${error.statusCode}`)); if (error) return callback(new BoxError(BoxError.DOCKER_ERROR, `Unable to pull image ${manifest.dockerImage}. Please check the network or if the image needs authentication. statusCode: ${error.statusCode}`)); // https://github.com/dotcloud/docker/issues/1074 says each status message @@ -180,14 +181,10 @@ function downloadImage(manifest, callback) { var attempt = 1; - async.retry({ times: 10, interval: 15000 }, function (retryCallback) { + async.retry({ times: 10, interval: 5000, errorFilter: e => e.reason !== BoxError.NOT_FOUND }, function (retryCallback) { debug('Downloading image %s. attempt: %s', manifest.dockerImage, attempt++); - pullImage(manifest, function (error) { - if (error) console.error(error); - - retryCallback(error); - }); + pullImage(manifest, retryCallback); }, callback); }