testcontainers / testcontainers-dotnet

A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions.
https://dotnet.testcontainers.org
MIT License
3.67k stars 254 forks source link

[Enhancement]: Add ability to specify image tag #1065

Closed ar0311 closed 7 months ago

ar0311 commented 7 months ago

Problem

At the moment, it appears the database image tags (version) are hard coded into the library.

Solution

Add the ability to pass in an image tag when creating a container so we can specify the version of the database being used?

Benefit

Use versions of the database engine other than those hardcoded into the library.

Alternatives

Fork the library?

Would you like to help contributing this enhancement?

Yes

HofmeisterAn commented 7 months ago

You can always override the default module configuration. To override the image, use the WithImage(string) API. Please note that modules are developed and configured with specific versions in mind. There might be cases where a version is incompatible with module configurations. Here is an example:

_ = new PostgreSqlBuilder().WithImage("postgres:15.5").Build();

If you have further questions, please do not hesitate to reopen the issue again.

ar0311 commented 7 months ago

@HofmeisterAn Thank you