Skip to content

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

Closed
credmond-git wants to merge 1 commit intoredis-field-engineering:masterfrom
credmond-git:master
Closed

Dont setup the ports until the docker container is being configured.#7
credmond-git wants to merge 1 commit intoredis-field-engineering:masterfrom
credmond-git:master

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