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 23
23
import com .github .dockerjava .api .DockerClient ;
24
24
import com .github .dockerjava .api .DockerException ;
25
25
import com .github .dockerjava .api .command .InspectContainerResponse ;
26
+ import com .github .dockerjava .api .NotFoundException ;
26
27
import com .github .dockerjava .api .model .Frame ;
27
28
import com .github .dockerjava .api .model .Volume ;
28
29
import com .github .dockerjava .api .model .VolumeBind ;
@@ -51,10 +52,13 @@ public void beforeTest() throws Exception {
51
52
LOG .info ("Connecting to Docker server" );
52
53
dockerClient = DockerClientBuilder .getInstance (config ()).withDockerCmdExecFactory (dockerCmdExecFactory ).build ();
53
54
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
+ }
58
62
59
63
assertNotNull (dockerClient );
60
64
LOG .info ("======================= END OF BEFORETEST =======================\n \n " );
You can’t perform that action at this time.
0 commit comments