File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/test/java/com/github/dockerjava/client Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2323import com .github .dockerjava .api .DockerClient ;
2424import com .github .dockerjava .api .DockerException ;
2525import com .github .dockerjava .api .command .InspectContainerResponse ;
26+ import com .github .dockerjava .api .NotFoundException ;
2627import com .github .dockerjava .api .model .Frame ;
2728import com .github .dockerjava .api .model .Volume ;
2829import com .github .dockerjava .api .model .VolumeBind ;
@@ -51,10 +52,13 @@ public void beforeTest() throws Exception {
5152 LOG .info ("Connecting to Docker server" );
5253 dockerClient = DockerClientBuilder .getInstance (config ()).withDockerCmdExecFactory (dockerCmdExecFactory ).build ();
5354
54- LOG .info ("Pulling image 'busybox'" );
55-
56- // need to block until image is pulled completely
57- dockerClient .pullImageCmd ("busybox" ).withTag ("latest" ).exec (new PullImageResultCallback ()).awaitSuccess ();
55+ try {
56+ dockerClient .inspectImageCmd ("busybox" ).exec ();
57+ } catch (NotFoundException e ) {
58+ LOG .info ("Pulling image 'busybox'" );
59+ // need to block until image is pulled completely
60+ dockerClient .pullImageCmd ("busybox" ).withTag ("latest" ).exec (new PullImageResultCallback ()).awaitSuccess ();
61+ }
5862
5963 assertNotNull (dockerClient );
6064 LOG .info ("======================= END OF BEFORETEST =======================\n \n " );
You can’t perform that action at this time.
0 commit comments