Best practice and details in container #1210
-
For my new project IdentityProxy I need the hostname and the assigned port set as a environment variable on the container itself. In the best practice it says that I better use the Like The But that does not follow the guidelines on the hostname. Background is that I'm returning a metadata url (for authentication) where I want to change a single entry |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
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: This allows multiple Kafka instances to run simultaneously without encountering any port clashes. Hope that helps. |
Beta Was this translation helpful? Give feedback.
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:
testcontainers-dotnet/src/Testcontainers.Kafka/KafkaBuilder.cs
Line 82 in a0f1f76
This allows multiple Kafka instances to run simultaneously without encountering any port clashes. Hope that helps.