Skip to content

Best practice and details in container #1210

Answered by HofmeisterAn
svrooij asked this question in Q&A
Discussion options

You must be logged in to vote

If the service running inside the container needs to know the randomly assigned host port, it usually requires modifying or adjusting the entrypoint and the container startup configuration. For example, Kafka has similar requirements, and we use the following configuration for it:

startupScript.Append("export KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://" + container.Hostname + ":" + container.GetMappedPublicPort(KafkaPort) + ",BROKER://" + container.IpAddress + ":" + BrokerPort);

This allows multiple Kafka instances to run simultaneously without encountering any port clashes. Hope that helps.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@HofmeisterAn
Comment options

@svrooij
Comment options

@HofmeisterAn
Comment options

@svrooij
Comment options

@HofmeisterAn
Comment options

Answer selected by svrooij
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