testcontainers-dotnet
testcontainers-dotnet copied to clipboard
Support for credentials from environment variables
Describe the solution you'd like For CI/CD purposes, it'd be really useful to be able to auth via environment variables that contains the Docker config data. Here is an example: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#determine-your-docker_auth_config-data
Something like that:
The env variable DOCKER_AUTH_CONFIG
is not yet supported. Base64 just works with ~/.docker/config.json
. Anyway, it is not difficult to implement. We just need another provider. Something like: https://github.com/testcontainers/testcontainers-dotnet/blob/0f4d0ff3ab79567bda94b8d3d41e0a9987665497/src/Testcontainers/Builders/Base64Provider.cs#L12
To read the value from the env variable or ~/.testcontainers.properties
file, we need another getter in:
https://github.com/testcontainers/testcontainers-dotnet/blob/0f4d0ff3ab79567bda94b8d3d41e0a9987665497/src/Testcontainers/Configurations/PropertiesFileConfiguration.cs#L11
Probably we can use the same test cases, like we are using for ~/.docker/config.json
:
https://github.com/testcontainers/testcontainers-dotnet/blob/0f4d0ff3ab79567bda94b8d3d41e0a9987665497/tests/Testcontainers.Tests/Unit/Configurations/DockerRegistryAuthenticationProviderTest.cs#L62
Would you like to create a pull request?
Sure, I would try