You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to define the container hostname. This is available in the .NET and Java TestContainers frameworks, but not in the NodeJS framework
I understand this is a duplicate of #865 , however on reading the discussion there it is not clear to me what the rationale is for closing that issue :(
My specific use case is that I would like to set up a PostgreSQL container for integration testing in a TypeScript backend. Currently the container.getHost() method resolves to localhost and I am not clear how to change this for the PostgreSQL container. This is especially an issue when I need to orchestrate multiple TestContainers for the E2E tests, and the TypeScript backend app itself is using the localhost:... namespace already.
The text was updated successfully, but these errors were encountered:
To give some further clarification on why customizing the container hostname is needed:
To configure a DbConnection for an ORM framework (Entity Framework, TypeORM), the host is a required parameter
It is ok to use localhost for the DbConnection host on my local machine - The ORM framework is running on the Docker host (my local machine), and the PostgreSQL container is running with an exposed port:
ORM framework will seek to connect to localhost: port
Docker host (my local machine) will receive this request
Because of port binding, Docker host can route this connection request to the PostgreSQL container
However if I run this in a CI pipeline or pod, then localhost may not be an available hostname on the Docker host (not my local machine anymore). Then the ORM framework will fail to connect to the PostgreSQL container running on TestContainers, and we have no available static config to facilitate the DbConnection
I would like to define the container hostname. This is available in the .NET and Java TestContainers frameworks, but not in the NodeJS framework
I understand this is a duplicate of #865 , however on reading the discussion there it is not clear to me what the rationale is for closing that issue :(
My specific use case is that I would like to set up a PostgreSQL container for integration testing in a TypeScript backend. Currently the
container.getHost()
method resolves tolocalhost
and I am not clear how to change this for the PostgreSQL container. This is especially an issue when I need to orchestrate multiple TestContainers for the E2E tests, and the TypeScript backend app itself is using thelocalhost:...
namespace already.The text was updated successfully, but these errors were encountered: