Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Docker Client protocol magically changed from tcp to http in oracle-xe #8794

Open
vosk opened this issue Jun 20, 2024 · 2 comments
Open
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. type/bug

Comments

@vosk
Copy link

vosk commented Jun 20, 2024

Module

Oracle XE

Testcontainers version

1.19.7

Using the latest Testcontainers version?

No

Host OS

Linux

Host Arch

x86

Docker version

Server Version: 26.1.4
      API Version: 1.45
      Operating System: Alpine Linux v3.20 (containerized)
      Total Memory: 63009 MB

What happened?

I am using spring boot +
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
to initialize stuff. I am running a junit test using a real db to do stuff.

When running testcontainers in dind gitlab-ci, I am setting DOCKER_HOST=tcp://dockerdind:8076 (tried port 2375/2376 also). Somehow the ryuk container works but when I try to initialize Oracle-xe using

new OracleContainer("gvenzl/oracle-xe:slim")
.withUsername("XX")
.withPassword("XX")
.withConnectTimeoutSeconds(120) //no effect on bug
.withStartupTimeoutSeconds(120) //no effect on bug
.withCopyFileToContainer(MountableFile.forClasspathResource("XXsql"), "/container-entrypoint-initdb.d/init.sql");
The container fails to initialize

Relevant log output

16:52:31.933 [ForkJoinPool-1-worker-1] INFO  o.t.d.DockerClientProviderStrategy -- Found Docker environment with Environment variables, system properties and defaults. Resolved dockerHost=tcp://dockerdind:8076
    16:52:31.935 [ForkJoinPool-1-worker-1] INFO  o.testcontainers.DockerClientFactory -- Docker host IP address is dockerdind
    16:52:31.952 [ForkJoinPool-1-worker-1] INFO  o.testcontainers.DockerClientFactory -- Connected to docker: 
      Server Version: 26.1.4
      API Version: 1.45
      Operating System: Alpine Linux v3.20 (containerized)
      Total Memory: 63009 MB
    16:52:31.985 [ForkJoinPool-1-worker-1] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling docker image: testcontainers/ryuk:0.6.0. Please be patient; this may take some time but only needs to be done once.
    16:52:31.992 [ForkJoinPool-1-worker-1] INFO  o.t.utility.RegistryAuthLocator -- Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:latest, configFile: /root/.docker/config.json, configEnv: DOCKER_AUTH_CONFIG). Falling back to docker-java default behaviour. Exception message: Status 404: No config supplied. Checked in order: /root/.docker/config.json (file not found), DOCKER_AUTH_CONFIG (not set)
    16:52:33.076 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Starting to pull image
    16:52:33.093 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  0 pending,  0 downloaded,  0 extracted, (0 bytes/0 bytes)
    16:52:33.664 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  2 pending,  1 downloaded,  0 extracted, (3 KB/? MB)
    16:52:33.721 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  1 pending,  2 downloaded,  0 extracted, (37 KB/? MB)
    16:52:33.791 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  0 pending,  3 downloaded,  0 extracted, (3 MB/6 MB)
    16:52:33.820 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  0 pending,  3 downloaded,  1 extracted, (3 MB/6 MB)
    16:52:33.900 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  0 pending,  3 downloaded,  2 extracted, (3 MB/6 MB)
    16:52:33.936 [docker-java-stream--623331358] INFO  tc.testcontainers/ryuk:0.6.0 -- Pulling image layers:  0 pending,  3 downloaded,  3 extracted, (6 MB/6 MB)
    16:52:33.949 [ForkJoinPool-1-worker-1] INFO  tc.testcontainers/ryuk:0.6.0 -- Image testcontainers/ryuk:0.6.0 pull took PT1.963095837S
    16:52:33.972 [ForkJoinPool-1-worker-1] INFO  tc.testcontainers/ryuk:0.6.0 -- Creating container for image: testcontainers/ryuk:0.6.0
    16:52:34.107 [ForkJoinPool-1-worker-1] INFO  tc.testcontainers/ryuk:0.6.0 -- Container testcontainers/ryuk:0.6.0 is starting: 04671a07aec9efde15793d51c36b5330cd598e1de5cf12a9f44d527d20fc38ec
    16:52:34.411 [ForkJoinPool-1-worker-1] INFO  tc.testcontainers/ryuk:0.6.0 -- Container testcontainers/ryuk:0.6.0 started in PT0.438817476S
    16:52:34.414 [ForkJoinPool-1-worker-1] INFO  o.t.utility.RyukResourceReaper -- Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
    16:52:34.414 [ForkJoinPool-1-worker-1] INFO  o.testcontainers.DockerClientFactory -- Checking the system...
    16:52:34.414 [ForkJoinPool-1-worker-1] INFO  o.testcontainers.DockerClientFactory -- ✔︎ Docker server version should be at least 1.6.0
    16:52:34.416 [ForkJoinPool-1-worker-1] INFO  tc.gvenzl/oracle-xe:slim -- Pulling docker image: gvenzl/oracle-xe:slim. Please be patient; this may take some time but only needs to be done once.
    16:52:35.464 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Starting to pull image
    16:52:35.465 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  0 downloaded,  0 extracted, (0 bytes/0 bytes)
    16:52:36.389 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  5 pending,  1 downloaded,  0 extracted, (141 MB/? MB)
    16:52:36.946 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  4 pending,  2 downloaded,  0 extracted, (263 MB/? MB)
    16:52:37.346 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  3 pending,  3 downloaded,  0 extracted, (313 MB/? MB)
    16:52:38.209 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  2 pending,  4 downloaded,  0 extracted, (454 MB/? MB)
    16:52:38.865 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  1 pending,  5 downloaded,  0 extracted, (561 MB/? MB)
    16:52:39.319 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  1 pending,  5 downloaded,  1 extracted, (596 MB/? MB)
    16:52:40.174 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  1 extracted, (684 MB/717 MB)
    16:52:41.754 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  2 extracted, (690 MB/717 MB)
    16:52:44.801 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  3 extracted, (696 MB/717 MB)
    16:52:46.667 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  4 extracted, (705 MB/717 MB)
    16:52:48.694 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  5 extracted, (707 MB/717 MB)
    16:52:49.799 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pulling image layers:  0 pending,  6 downloaded,  6 extracted, (717 MB/717 MB)
    16:52:49.816 [ForkJoinPool-1-worker-1] INFO  tc.gvenzl/oracle-xe:slim -- Image gvenzl/oracle-xe:slim pull took PT15.399040448S
    16:52:49.816 [docker-java-stream-1694500792] INFO  tc.gvenzl/oracle-xe:slim -- Pull complete. 6 layers, pulled in 14s (downloaded 717 MB at 51 MB/s)
    16:52:49.819 [ForkJoinPool-1-worker-1] INFO  tc.gvenzl/oracle-xe:slim -- Creating container for image: gvenzl/oracle-xe:slim
    16:53:00.198 [ForkJoinPool-1-worker-1] INFO  tc.gvenzl/oracle-xe:slim -- Container gvenzl/oracle-xe:slim is starting: 016b284a85efafc21650661d3be381a445a4409725e9447bf66acdc7ca093311
    16:57:01.558 [ForkJoinPool-1-worker-1] ERROR tc.gvenzl/oracle-xe:slim -- Could not start container
    java.lang.RuntimeException: com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.HttpHostConnectException: Connect to http://dockerdind:8076 [dockerdind/127.0.0.1] failed: Connection refused
    	at com.github.dockerjava.zerodep.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:210)
    	at com.github.dockerjava.zerodep.ZerodepDockerHttpClient.execute(ZerodepDockerHttpClient.java:8)
    	at org.testcontainers.dockerclient.HeadersAddingDockerHttpClient.execute(HeadersAddingDockerHttpClient.java:23)
    	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
    	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:202)
    	at org.testcontainers.shaded.com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:74)
    	at org.testcontainers.shaded.com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:31)
    	at org.testcontainers.shaded.com.github.dockerjava.core.exec.InspectContainerCmdExec.execute(InspectContainerCmdExec.java:13)
    	at org.testcontainers.shaded.com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
    	at org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:33)
    	at org.testcontainers.shaded.com.github.dockerjava.core.command.InspectContainerCmdImpl.exec(InspectContainerCmdImpl.java:51)
    	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:505)
    	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
    	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
    	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
    	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
    	at <redacted>
    	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
    	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
    	at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
    	at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:185)
    	at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
    	at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
    	at java.base/java.lang.reflect.Field.get(Field.java:425)
    	at org.springframework.util.ReflectionUtils.getField(ReflectionUtils.java:672)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.getFieldValue(ServiceConnectionContextCustomizerFactory.java:95)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.createSource(ServiceConnectionContextCustomizerFactory.java:80)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.lambda$collectSources$0(ServiceConnectionContextCustomizerFactory.java:63)
    	at org.springframework.core.annotation.TypeMappedAnnotations$AggregatesSpliterator.tryAdvance(TypeMappedAnnotations.java:607)
    	at org.springframework.core.annotation.TypeMappedAnnotations$AggregatesSpliterator.tryAdvance(TypeMappedAnnotations.java:574)
    	at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
    	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.lambda$collectSources$1(ServiceConnectionContextCustomizerFactory.java:63)
    	at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:691)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.collectSources(ServiceConnectionContextCustomizerFactory.java:60)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.collectSources(ServiceConnectionContextCustomizerFactory.java:71)
    	at org.springframework.boot.testcontainers.service.connection.ServiceConnectionContextCustomizerFactory.createContextCustomizer(ServiceConnectionContextCustomizerFactory.java:52)
    	at org.springframework.test.context.support.AbstractTestContextBootstrapper.getContextCustomizers(AbstractTestContextBootstrapper.java:360)
    	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:332)
    	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:267)
    	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:215)
    	at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:108)
    	at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:111)
    	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:142)
    	at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:126)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore.lambda$getOrComputeIfAbsent$5(NamespacedHierarchicalStore.java:147)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.computeValue(NamespacedHierarchicalStore.java:372)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore$MemoizingSupplier.get(NamespacedHierarchicalStore.java:361)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.evaluate(NamespacedHierarchicalStore.java:308)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore$StoredValue.access$200(NamespacedHierarchicalStore.java:287)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:149)
    	at org.junit.platform.engine.support.store.NamespacedHierarchicalStore.getOrComputeIfAbsent(NamespacedHierarchicalStore.java:168)
    	at org.junit.jupiter.engine.execution.NamespaceAwareStore.lambda$getOrComputeIfAbsent$3(NamespaceAwareStore.java:66)
    	at org.junit.jupiter.engine.execution.NamespaceAwareStore.accessStore(NamespaceAwareStore.java:90)
    	at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:65)
    	at org.springframework.test.context.junit.jupiter.SpringExtension.getTestContextManager(SpringExtension.java:366)
    	at org.springframework.test.context.junit.jupiter.SpringExtension.beforeAll(SpringExtension.java:131)
    	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:396)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:396)
    	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:212)
    	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:85)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)
    	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.executeNonConcurrentTasks(ForkJoinPoolHierarchicalTestExecutorService.java:172)
    	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.invokeAll(ForkJoinPoolHierarchicalTestExecutorService.java:152)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
    	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
    	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
    	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
    	at org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService$ExclusiveTask.compute(ForkJoinPoolHierarchicalTestExecutorService.java:202)
    	at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

Additional Information

No response

@vosk vosk added the type/bug label Jun 20, 2024
@bortolatto
Copy link

Hey, did you find any solution to this? I have the same problem here.

@eddumelendez
Copy link
Member

Hi, have you followed the configuration described in docs? Can you share a small project that reproduces your issues with gitlab configuration if it is different than the one provided in docs?

@eddumelendez eddumelendez added the resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. type/bug
Projects
None yet
Development

No branches or pull requests

3 participants