-
Notifications
You must be signed in to change notification settings - Fork 18
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
No host port mapping after creating container #3
Comments
In which environment are you running PHPUnit? We use the internal IP of the container right now, so we don't have to do any port mapping :) |
Testcontainer Java uses random ports if it is not set, this way can avoid port conflict. After container is started, we can get the real exposed port. |
Do you have an link to the implementation? What do they use as "IP", that would be interesting 🤔, hard-code 127.0.0.1 🤔 |
I used Testcontainers Java in projects for years, and by default when declaring a container, it will expose all ports, and map to random ports of clients(your machine), it has APIs to get the mapped ports, and first mapping port, etc. |
I noticed when creating a new MySQLContainer like so
but when checking out the docker container with
docker ps
anddocker inspect
there is no port mapped to the host (localhost). And then when I try to connect to it like sohost missing when inspecting the container
I get this timeout error
here the container in Docker Desktop
The text was updated successfully, but these errors were encountered: