44import java .util .ArrayList ;
55import java .util .Collections ;
66import java .util .List ;
7+ import java .util .concurrent .atomic .AtomicBoolean ;
78import java .util .function .Function ;
89import java .util .stream .Stream ;
910
@@ -22,6 +23,7 @@ public abstract class NativeImageBuildContainerRunner extends NativeImageBuildRu
2223 protected final ContainerRuntimeUtil .ContainerRuntime containerRuntime ;
2324 String [] baseContainerRuntimeArgs ;
2425 private final String containerName ;
26+ private final AtomicBoolean setupInvoked = new AtomicBoolean ();
2527
2628 protected NativeImageBuildContainerRunner (NativeConfig nativeConfig ) {
2729 this .nativeConfig = nativeConfig ;
@@ -39,7 +41,10 @@ public boolean isContainer() {
3941
4042 @ Override
4143 public void setup (boolean processInheritIODisabled ) {
42- if (containerRuntime != ContainerRuntimeUtil .ContainerRuntime .UNAVAILABLE ) {
44+ if (containerRuntime == ContainerRuntimeUtil .ContainerRuntime .UNAVAILABLE ) {
45+ return ;
46+ }
47+ if (setupInvoked .compareAndSet (false , true )) {
4348 log .infof ("Using %s to run the native image builder" , containerRuntime .getExecutableName ());
4449 // we pull the docker image in order to give users an indication of which step the process is at
4550 // it's not strictly necessary we do this, however if we don't the subsequent version command
@@ -91,6 +96,7 @@ public void setup(boolean processInheritIODisabled) {
9196 pull (effectiveBuilderImage , processInheritIODisabled );
9297 }
9398 }
99+
94100 }
95101
96102 private void pull (String effectiveBuilderImage , boolean processInheritIODisabled ) {
0 commit comments