testcontainers don't work with Jenkins running on docker #6588
jelbatnigi
started this conversation in
General
Replies: 1 comment
-
Hi @jelbatnigi I think this is still related to #6584 I would appreciate if you can share your findings in the same discussion. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It seems that when running a JdbcDatabaseContainer inside a dockerized Jenkins things don't work.
I have an integration test that required to spin up a postgres testcontainer. Everything runs fine when I run it locally.
But when I run my integrationtest as part of my build in jenkins. first I get
Could not connect to Ryuk at 172.17.0.1:xxxx
I figured this is because the way I am running my Jenkins container I have to expose all ports since Ryuk runs on a random port.
I reran my Jenkins container using
docker run --network=host
That resolved the Ryuk error even through running with --networ=host I couldn't access Jenkins on port 8080 for some reason. But with that when I run my integration test I now get
Connection to localhost:5432 refused
which basically the I cannot connect to the postgres test containerSo I can't really find a way to get this to work. The bottom line is I cannot run testcontainers inside another container or specifically inside a Jenkins container.
this is how I initialize my testcontainer:
@Container public static JdbcDatabaseContainer container = (JdbcDatabaseContainer) new PostgreSQLContainer(DB_TEST_CONTAINER_NAME).withDatabaseName(DB_TEST_CONTAINER_DB_NAME) .withUsername(DB_TEST_CONTAINER_USER).withPassword(DB_TEST_CONTAINER_PASSWORD).withInitScript("db/migration/create_dba_role.sql");
Any idea or feed back I will appreciate it.
Beta Was this translation helpful? Give feedback.
All reactions