Skip to content

Port mapping #902

Answered by HofmeisterAn
tjpeel asked this question in Q&A
May 24, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

so it's container port first and then host port as the second param.

To avoid any misunderstanding. It is WithPortBinding(hostPort, containerPort), but for the random assigned host ports it is WithPortBinding(containerPort, true):

/// <summary>
/// Binds the container port to a random host port.
/// </summary>
/// <param name="port">The container port.</param>
/// <param name="assignRandomHostPort">Determines whether Testcontainers assigns a random host port or not.</param>
/// <returns>A configured instance of <typeparamref name="TBuilderEntity" />.<…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tjpeel
Comment options

@HofmeisterAn
Comment options

Answer selected by tjpeel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants