Skip to content

Commit d19b206

Browse files
committed
check docker daemon status
1 parent 96b0cf8 commit d19b206

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,29 @@ if (NBL_WITH_DOCKER)
216216
message(FATAL_ERROR "Docker installer exited with non-zero return code")
217217
endif()
218218
endif()
219+
220+
macro(wait5sec)
221+
execute_process(COMMAND powershell -Command "Start-Sleep -Seconds 5")
222+
endmacro()
223+
224+
# DDT stands for Docker Daemon Test
225+
set(DDT_MAX_ATTEMPTS 10)
226+
set(DDT_DOCKER_RESPONDING False)
227+
foreach(ATTEMPT RANGE 1 ${DDT_MAX_ATTEMPTS})
228+
message(STATUS "Attempt ${ATTEMPT} of ${DDT_MAX_ATTEMPTS}: Checking Docker Endpoint")
229+
execute_process(COMMAND ${DOCKER_EXECUTABLE} info RESULT_VARIABLE DOCKER_EXIT_CODE OUTPUT_QUIET)
230+
231+
if (DOCKER_EXIT_CODE EQUAL 0)
232+
set(DDT_DOCKER_RESPONDING True)
233+
break()
234+
endif()
235+
236+
wait5sec()
237+
endforeach()
238+
239+
if (NOT DDT_DOCKER_RESPONDING)
240+
message(FATAL_ERROR "Docker Daemon is not responding. Please make sure it's running in the background")
241+
endif()
219242
endif()
220243

221244
set(THIRD_PARTY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/3rdparty")

0 commit comments

Comments
 (0)