Open jalaziz opened 10 months ago
@jalaziz @cristianrgreco any solution for this?
I was in a previous project using:
const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
.withEnvironment({
...
})
.withWaitStrategy(serviceName, Wait.forHealthCheck())
.up([serviceName]);
But now for a new project with lot of dependencies updated (ESM modules, different Node version...), it times out saying Port 52670 not bound after 60000ms
(it seems to come from https://github.com/testcontainers/testcontainers-node/blob/9805f226ed259e451c46f15d3988bdff992c46d8/packages/testcontainers/src/wait-strategies/host-port-wait-strategy.ts#L45-L57).
Note I tried to use testcontainers
with the latest version and also v9.6.0
that is on the other project.
Thank you,
EDIT: I'm on a MacOS Intel
EDIT2: I did other attempts to run the test without ESM settings into my Jest setup, but it's the same error. It's so weird...
EDIT3: On my side I'm using the strategy Wait.forHealthCheck()
for both the working and failing projects
After spending some time on it, it seems my old way of bindings ports to make them random on the list:
ports:
- '127.0.0.1::5432'
is not working for any reason on the new project.
Switching to:
ports:
- '5432'
Don't tell why... the old way is working in a project with direct dependencies versions aligned (also I don't remember why I had to use the 127.0.0.1
at that time). Hope it helps 👍
@jalaziz @cristianrgreco any solution for this?
Unfortunately no solution. I've switched to Wait.forHealthCheck()
with custom healtchecks for the time being.
I think I just ran into this -- except I can't actually get the custom health check to pass either, even with test: ["CMD-SHELL", "exit 0"]
it just fails for however long.
It would be nice if there wasn't a default healthcheck (or it could be disbaled) that tried to use the ports -- it's helpful but a way to disable that logic would be nice
Expected Behaviour
When launching a container with a port bound to localhost, the wait strategy should work.
Actual Behaviour
The
HostPortWaitStrategy
fails to recognize the open port and eventually times out. This issue seems to only occur on Linux machines. MacOS works fine.Testcontainer Logs
Steps to Reproduce
Environment Information