testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
8.03k stars 1.65k forks source link

[Bug]: testcontainer stuck at: Waiting for database connection to become available at jdbc:mysql://x.x.x.x:xxxx/test using query 'SELECT 1' and finally throws exception stating it can not connect to database #7334

Closed hatefap closed 1 year ago

hatefap commented 1 year ago

Module

MySQL

Testcontainers version

1.18.3

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host Arch

x86

Docker version

Client:
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.1
 Git commit:        20.10.21-0ubuntu1~22.04.3
 Built:             Thu Apr 27 05:57:17 2023
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:45 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

Hi we are using SpringBoot 3.1.2 and trying to use testconainer in our gitlab pipeline.

here is our .gitlab-ci.yml

variables:
   TESTCONTAINERS_RYUK_DISABLED: 'true'

stages:
  - test

test:
  image: docker.xyz.dev/docker.io/library/maven:3.9.3-eclipse-temurin-20
  before_script: # install docker
    - apt update && for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do apt-get remove $pkg; done && apt install --no-install-recommends -y docker.io
    - mkdir -p $HOME/.docker
  artifacts:
    expire_in: 1hrs
    paths:
      - target/
  script:
    - docker version
    - mvn clean test
  stage: test

my simple project that you can access it from here perfectly run in my local workstation but in pipeline it throws exception stating it can not connect to MySQL.

here is my test class:

package ir.mci.demotestcontainer;

import java.time.Duration;
import java.util.Map;
import javax.sql.DataSource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.context.jdbc.Sql;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

@SpringBootTest
@Testcontainers
class DemoTestcontainerApplicationTests {

    @Container
    static MySQLContainer<?> mysql = new MySQLContainer<>(DockerImageName.parse("docker.xyz.dev/mysql:latest")
            .asCompatibleSubstituteFor("mysql"))
            .withNetwork(Network
                    .NetworkImpl
                    .builder()
                    .createNetworkCmdModifier(
                            cm -> cm.withOptions(Map.of("com.docker.network.bridge.host_binding_ipv4", "127.0.0.1")))
                    .build())
            .withExposedPorts(3306)
            .withStartupTimeout(Duration.ofMinutes(1))
            .withConnectTimeoutSeconds(60);
    @Autowired
    PersonRepo repo;
    @Autowired
    DataSource dataSource;

    @DynamicPropertySource
    static void redisProperties(DynamicPropertyRegistry registry) {
        registry.add("spring.datasource.url", () -> mysql.getJdbcUrl());
        registry.add("spring.datasource.username", () -> mysql.getUsername());
        registry.add("spring.datasource.password", () -> mysql.getPassword());
    }

    @Sql(scripts = "classpath:user-data.sql")
    @Test
    void contextLoads() {
        var persons = repo.findAll();
        System.out.println(persons);
        Assertions.assertEquals(2, persons.size());
    }
}

it stuck at Waiting for database connection to become available at jdbc:mysql://192.168.50.1:49159/test using query 'SELECT 1' and finally throws exception.

you can access to full log from here: https://pastebin.com/xg7LmYsw

Relevant log output

12:51:39.658 [main] INFO org.testcontainers.DockerClientFactory -- Checking the system...
    12:51:39.658 [main] INFO org.testcontainers.DockerClientFactory -- ✔︎ Docker server version should be at least 1.6.0
    12:51:39.831 [main] INFO tc.docker.xyz.dev/mysql:latest -- Creating container for image: docker.xyz.dev/mysql:latest
    12:51:39.837 [main] INFO org.testcontainers.utility.RegistryAuthLocator -- Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: docker.xyz.dev/mysql: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)
    12:51:40.213 [main] INFO tc.docker.xyz.dev/mysql:latest -- Container docker.xyz.dev/mysql:latest is starting: 81f7e0959befe9df124624fcf11b4f1cfadaa86e02f76581017655ddf1325344
    12:51:40.722 [main] INFO tc.docker.xyz.dev/mysql:latest -- Waiting for database connection to become available at jdbc:mysql://192.168.50.1:49159/test using query 'SELECT 1'
    12:53:40.958 [main] ERROR tc.docker.xyz.dev/mysql:latest -- Could not start container
    java.lang.IllegalStateException: Container is started, but cannot be accessed by (JDBC URL: jdbc:mysql://192.168.50.1:49159/test), please check container logs
        at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:176)
        at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:490)
        at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)
        at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
        at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
        at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.start(TestcontainersExtension.java:274)
        at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.access$200(TestcontainersExtension.java:261)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$null$3(TestcontainersExtension.java:76)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$getOrComputeIfAbsent$4(ExtensionValuesStore.java:86)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.computeValue(ExtensionValuesStore.java:223)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.get(ExtensionValuesStore.java:211)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.evaluate(ExtensionValuesStore.java:191)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore$StoredValue.access$100(ExtensionValuesStore.java:171)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:89)
        at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:53)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$startContainers$4(TestcontainersExtension.java:76)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.startContainers(TestcontainersExtension.java:76)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.beforeAll(TestcontainersExtension.java:56)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
        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 java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        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.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
        at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:50)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
    Caused by: java.sql.SQLException: Could not create new connection
        at org.testcontainers.containers.JdbcDatabaseContainer.createConnection(JdbcDatabaseContainer.java:262)
        at org.testcontainers.containers.JdbcDatabaseContainer.createConnection(JdbcDatabaseContainer.java:218)
        at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:158)
        ... 62 common frames omitted
    Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:175)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:446)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:239)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:188)
        at org.testcontainers.containers.JdbcDatabaseContainer.createConnection(JdbcDatabaseContainer.java:253)
        ... 64 common frames omitted
    Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:150)
        at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:166)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
        at com.mysql.cj.NativeSession.connect(NativeSession.java:121)
        at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:945)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:815)
        ... 68 common frames omitted
    Caused by: java.net.ConnectException: Connection refused
        at java.base/sun.nio.ch.Net.connect0(Native Method)
        at java.base/sun.nio.ch.Net.connect(Net.java:580)
        at java.base/sun.nio.ch.Net.connect(Net.java:569)
        at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:576)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
        at java.base/java.net.Socket.connect(Socket.java:666)
        at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:153)
        at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
        ... 71 common frames omitted
    12:53:41.001 [main] ERROR tc.docker.xyz.dev/mysql:latest -- Log output from the failed container:
    2023-07-25 12:51:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.34-1.el8 started.
    2023-07-25 12:51:40+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    2023-07-25 12:51:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.34-1.el8 started.
    2023-07-25 12:51:41+00:00 [Note] [Entrypoint]: Initializing database files
    2023-07-25T12:51:41.079253Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:41.079299Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:41.079413Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.34) initializing of server in progress as process 80
    2023-07-25T12:51:41.084717Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=10485760. Please use innodb_redo_log_capacity instead.
    2023-07-25T12:51:41.086412Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    2023-07-25T12:51:41.532082Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    2023-07-25T12:51:43.799975Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
    2023-07-25T12:51:45.382149Z 0 [Warning] [MY-013865] [InnoDB] Redo log writer is waiting for a new redo log file. Consider increasing innodb_redo_log_capacity.
    2023-07-25 12:51:48+00:00 [Note] [Entrypoint]: Database files initialized
    2023-07-25 12:51:48+00:00 [Note] [Entrypoint]: Starting temporary server
    2023-07-25T12:51:49.021930Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:49.021983Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:49.023949Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 124
    2023-07-25T12:51:49.038746Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=10485760. Please use innodb_redo_log_capacity instead.
    2023-07-25T12:51:49.041585Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    2023-07-25T12:51:49.174647Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    2023-07-25T12:51:49.591748Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    2023-07-25T12:51:49.591799Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    2023-07-25T12:51:49.593671Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    2023-07-25T12:51:49.625081Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
    2023-07-25T12:51:49.625118Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
    2023-07-25 12:51:49+00:00 [Note] [Entrypoint]: Temporary server started.
    '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
    Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
    Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
    Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
    Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
    Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
    Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
    2023-07-25 12:51:52+00:00 [Note] [Entrypoint]: Creating database test
    2023-07-25 12:51:52+00:00 [Note] [Entrypoint]: Creating user test
    2023-07-25 12:51:52+00:00 [Note] [Entrypoint]: Giving user test access to schema test
    2023-07-25 12:51:52+00:00 [Note] [Entrypoint]: Stopping temporary server
    2023-07-25T12:51:52.984887Z 13 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.34).
    2023-07-25T12:51:53.882412Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34)  MySQL Community Server - GPL.
    2023-07-25 12:51:53+00:00 [Note] [Entrypoint]: Temporary server stopped
    2023-07-25 12:51:53+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
    2023-07-25T12:51:54.243914Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:54.243967Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    2023-07-25T12:51:54.246051Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 1
    2023-07-25T12:51:54.251143Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=10485760. Please use innodb_redo_log_capacity instead.
    2023-07-25T12:51:54.253428Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    2023-07-25T12:51:54.395329Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    2023-07-25T12:51:54.784435Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    2023-07-25T12:51:54.784489Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    2023-07-25T12:51:54.786279Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    2023-07-25T12:51:54.821507Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
    2023-07-25T12:51:54.821722Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
    12:53:41.003 [main] INFO tc.docker.xyz.dev/mysql:latest -- Creating container for image: docker.xyz.dev/mysql:latest
    12:53:41.173 [main] INFO tc.docker.xyz.dev/mysql:latest -- Container docker.xyz.dev/mysql:latest is starting: 0b581b6af983b098635c6fea4051991ff8553613d621a0571395a443f53149b7
    12:53:41.527 [main] INFO tc.docker.xyz.dev/mysql:latest -- Waiting for database connection to become available at jdbc:mysql://192.168.50.1:49160/test using query 'SELECT 1'
   ....
   ....
    [INFO] 
    [INFO] Results:
    [INFO] 
    [ERROR] Errors: 
    [ERROR]   DemoTestcontainerApplicationTests » ContainerLaunch Container startup failed for image docker.xyz.dev/mysql:latest
    [INFO] 
    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  07:03 min
    [INFO] Finished at: 2023-07-25T12:57:43Z
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0:test (default-test) on project demo-testcontainer: 
    [ERROR] 
    [ERROR] Please refer to /builds/-Why3mAw/0/h.alipour/test-container-demo/target/surefire-reports for the individual test results.
    [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
    [ERROR] -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    Cleaning up project directory and file based variables
    00:00
    Using docker image sha256:ba27b5065a40ecfcb0ebf75f8bf6eaedde252c567a22ff7354915972d0bf4e33 for hub.hamdocker.ir/gitlab/gitlab-runner-helper:x86_64-v14.4.2 with digest hub.hamdocker.ir/gitlab/gitlab-runner-helper@sha256:879dd06707442760c0f38e6619823cc4fb25aebc315b85f4e0be6bad2a41ff1a ...
    ERROR: Job failed: exit code 1

Additional Information

No response

eddumelendez commented 1 year ago

Have you tried with the setup described in the docs?

hatefap commented 1 year ago

Have you tried with the setup described in the docs?

for the first approach, I didn't have access to change the runner file but I've tried the second approach, I got an error stating that Docker is not listening on port 2375

eddumelendez commented 1 year ago

@hatefap There is also a blogpost I forgot share. I will close the issue but if the issue continues feel free the reopen it.