@@ -119,17 +119,35 @@ public DockerClient client() {
119119 " Operating System: " + dockerInfo .getOperatingSystem () + "\n " +
120120 " Total Memory: " + dockerInfo .getMemTotal () / (1024 * 1024 ) + " MB" );
121121
122- boolean checksEnabled = !TestcontainersConfiguration .getInstance ().isDisableChecks ();
123-
124- String ryukContainerId = ResourceReaper .start (hostIpAddress , client , checksEnabled );
125- log .info ("Ryuk started - will monitor and terminate Testcontainers containers on JVM exit" );
122+ String ryukContainerId = null ;
123+ boolean useRyuk = !Boolean .parseBoolean (System .getenv ("TESTCONTAINERS_RYUK_DISABLED" ));
124+ if (useRyuk ) {
125+ ryukContainerId = ResourceReaper .start (hostIpAddress , client );
126+ log .info ("Ryuk started - will monitor and terminate Testcontainers containers on JVM exit" );
127+ }
126128
127129 VisibleAssertions .info ("Checking the system..." );
128130
129131 checkDockerVersion (version .getVersion ());
130132
133+ boolean checksEnabled = !TestcontainersConfiguration .getInstance ().isDisableChecks ();
131134 if (checksEnabled ) {
132- checkDiskSpace (client , ryukContainerId );
135+ if (ryukContainerId != null ) {
136+ checkDiskSpace (client , ryukContainerId );
137+ } else {
138+ runInsideDocker (
139+ client ,
140+ createContainerCmd -> {
141+ createContainerCmd .withName ("testcontainers-checks-" + SESSION_ID );
142+ createContainerCmd .getHostConfig ().withAutoRemove (true );
143+ createContainerCmd .withCmd ("tail" , "-f" , "/dev/null" );
144+ },
145+ (__ , containerId ) -> {
146+ checkDiskSpace (client , containerId );
147+ return "" ;
148+ }
149+ );
150+ }
133151 }
134152
135153 initialized = true ;
0 commit comments