Why doesn't Gitlab CI want to run a container

1k views Asked by At

I have a Spring Boot Application (2.0.0) I try to execute my tests with testcontainers:

  • Locally : this work as excepted
  • In Gitlab-Ci : throw me a TimeoutException, I assume is because my runner doesn't have permissions or something like that.

I already followed the recommended instructions of TestContainers.org documentation.

Gitlab Runner Logs

2020-09-30 14:00:52.277  INFO 91 --- [MessageBroker-1] o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), 0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], stompBrokerRelay[null], inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], outboundChannelpool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], sockJsScheduler[pool size = 2, active threads = 1, queued tasks = 3, completed tasks = 0]
2020-09-30 14:00:56.168 ERROR 91 --- [    Test worker] tAndSystemPropertyClientProviderStrategy : ping failed with configuration Environment variables, system properties and defaults. Resolved dockerHost=tcp://docker:2375 due to org.rnorth.ducttape.TimeoutException: Timeout waiting for result with exception

    org.rnorth.ducttape.TimeoutException: Timeout waiting for result with exception
        at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:54) ~[duct-tape-1.0.8.jar:na]
        at org.testcontainers.dockerclient.DockerClientProviderStrategy.ping(DockerClientProviderStrategy.java:183) [testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy.test(EnvironmentAndSystemPropertyClientProviderStrategy.java:41) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$2(DockerClientProviderStrategy.java:118) [testcontainers-1.13.0.jar:na]
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) ~[na:1.8.0_212]
        at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:302) ~[na:1.8.0_212]
        at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731) ~[na:1.8.0_212]
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) ~[na:1.8.0_212]
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499) ~[na:1.8.0_212]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486) ~[na:1.8.0_212]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) ~[na:1.8.0_212]
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) ~[na:1.8.0_212]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:1.8.0_212]
        at java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:469) ~[na:1.8.0_212]
        at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:154) [testcontainers-1.13.0.jar:na]
        at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:113) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:134) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.LazyDockerClient.listImagesCmd(LazyDockerClient.java:12) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.images.LocalImagesCache.maybeInitCache(LocalImagesCache.java:68) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.images.LocalImagesCache.get(LocalImagesCache.java:32) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.images.AbstractImagePullPolicy.shouldPull(AbstractImagePullPolicy.java:18) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:62) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:25) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1263) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.GenericContainer.logger(GenericContainer.java:600) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:311) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:302) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:1008) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29) ~[testcontainers-1.13.0.jar:na]
        at org.junit.rules.RunRules.evaluate(RunRules.java:20) ~[junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12]
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.0.4.RELEASE.jar:5.0.4.RELEASE]
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110) ~[na:na]
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58) ~[na:na]
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38) ~[na:na]
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:66) ~[na:na]
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51) ~[na:na]
        at sun.reflect.GeneratedMethodAccessor471.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) ~[na:na]
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) ~[na:na]
        at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) ~[na:na]
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) ~[na:na]
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) ~[na:na]
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118) ~[na:na]
        at sun.reflect.GeneratedMethodAccessor470.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) ~[na:na]
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) ~[na:na]
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175) ~[na:na]
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157) ~[na:na]
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404) ~[na:na]
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) ~[na:na]
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) ~[na:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_212]
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) ~[na:na]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_212]
    Caused by: java.net.ConnectException: Failed to connect to docker/127.0.0.1:2375
        at org.testcontainers.shaded.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:265) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.RealCall.execute(RealCall.java:81) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:270) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.execute(OkHttpInvocationBuilder.java:265) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.transport.okhttp.OkHttpInvocationBuilder.get(OkHttpInvocationBuilder.java:231) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.transport.okhttp.OkHttpDockerCmdExecFactory$1.execute(OkHttpDockerCmdExecFactory.java:124) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.transport.okhttp.OkHttpDockerCmdExecFactory$1.execute(OkHttpDockerCmdExecFactory.java:117) ~[testcontainers-1.13.0.jar:na]
        at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21) ~[testcontainers-1.13.0.jar:na]
        at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$null$4(DockerClientProviderStrategy.java:186) [testcontainers-1.13.0.jar:na]
        at org.rnorth.ducttape.ratelimits.RateLimiter.getWhenReady(RateLimiter.java:51) ~[duct-tape-1.0.8.jar:na]
        at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$ping$5(DockerClientProviderStrategy.java:184) [testcontainers-1.13.0.jar:na]
        at org.rnorth.ducttape.unreliables.Unreliables.lambda$retryUntilSuccess$0(Unreliables.java:43) ~[duct-tape-1.0.8.jar:na]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_212]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_212]
        ... 1 common frames omitted
    Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_212]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_212]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_212]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_212]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_212]
        at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_212]
        at org.testcontainers.shaded.okhttp3.internal.platform.Platform.connectSocket(Platform.java:130) ~[testcontainers-1.13.0.jar:na]
        at org.testcontainers.shaded.okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:263) ~[testcontainers-1.13.0.jar:na]
        ... 33 common frames omitted

Does anyone know how to fix it?

0

There are 0 answers