Skip to content

Dont setup the ports until the docker container is being configured. #7

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

Closed
wants to merge 1 commit into from

Conversation

credmond-git
Copy link

Fixes #4
Before on the constructor it would call update, and this would add fixed exposed ports, locking in port 7000.
I removed the update in the constructor and moved it to the configure method inherited from GenericContainer.

When you start the docker container it calls the method protected void configure()
https://github.com/testcontainers/testcontainers-java/blob/3b7c2ebca73988b484a0bcdb339e7f04df016a41/core/src/main/java/org/testcontainers/containers/GenericContainer.java#L335

So we override the method and call update to setup the ports. This way we know everything has been set and we wont add any extra ports.

@credmond-git
Copy link
Author

Code has diverged greatly Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Even if I use another initialPort , the 7000 7001 7002 port still used
1 participant