Closed webstradev closed 1 week ago
Just a quick updatee as I have gone back a few versions of testcontainers-go and this issue is still prevalent, so maybe it is in issue with something that has changed in the docker engine...
Sorry, I might have opened this prematurely, but I will leave the solution here for anyone else that runs into this.
Adding a wait.ForListeningPort did the trick.
Not entirely sure why we didn't need this before because we have been using this for a few months, but maybe something changed either in the image we were using or in docker itself that made it start up faster than before.
I think this can be closed.
Hi @webstradev, in general, we recommend adding wait strategies to the containers in order to have the containers in the desired state before continuing with the tests, so I think it makes sense to have the wait strategy you mentioned.
Besides that, there are a few issues related to ports not being found, where https://github.com/testcontainers/testcontainers-go/issues/2580 could relate to this one.
As you suggested, I'm closing this one because of that.
Thanks!
Testcontainers version
0.31.0
Using the latest Testcontainers version?
Yes
Host OS
MacOS
Host arch
ARM
Go version
1.22.3
Docker version
Docker info
What happened?
Since about a week we updated to testcontainers 0.31.0. Now when running container.MappedPort(ctx, "4222/tcp") (which our code does in various places. We almost always get back a port not found error. Restarting docker causes the tests to sometimes work once and then we need to restart it again. Likely good to mention that these containers are added to a network through the go sdk.
Relevant log output
Additional information
We have had this issue only one week and I believe only since we updated to 0.31.0. I see some issues on the changelog relating to host binding so maybe there is some regression.