Skip to content

Support docker socket overrides to be set in ~/.testcontainers.properties #8869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

myhau
Copy link

@myhau myhau commented Jul 10, 2024

Fixes: #8537

@myhau myhau requested a review from a team as a code owner July 10, 2024 12:39
@kiview
Copy link
Member

kiview commented Jul 11, 2024

Thanks @myhau. While I think this goes into the right direction, we need to think through how this relates to the current strategy-independent callout to the environment config value in

String dockerSocketOverride = System.getenv("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE");
.

So I am wondering if we can solve it in a concise way across strategies (with potentially a better default for many strategies being /var/run/docker.sock rather than our current logic in

String path = "unix".equals(dockerHost.getScheme()) ? dockerHost.getRawPath() : "/var/run/docker.sock";
) and also align the behavior across languages.

@myhau
Copy link
Author

myhau commented Jul 17, 2024

@kiview

Thanks for the initial feedback!

I fully understand the need of approaching this holistically and doing the best possible thing for the user.

At the same time, the adoption of alternative container runtimes (Podman, Colima, Rancher) is growing on macOS (and Windows), and the ability to override Docker socket will always be necessary.

Do you think there is a chance we can merge this in the nearest future, or does taking a step back to solve it in a concise way across strategies require this PR to be put on hold?

(I will work on fixing the tests if you say we can continue with this.)

@jordanjennings
Copy link

@kiview Would you be able to provide additional feedback on how this PR can proceed? With more and more folks using something other than Docker Desktop this would be a very nice quality of life improvement.

Also - since at least one other implementation (.NET) supports this exact same config it would be a step towards consistency there as well. The golang implementation supports configuring it in the properties file too.

Thanks!

@mdelapenya
Copy link
Member

@jordanjennings we are working on a PoC for testcontainers-go, in which we want to proceed supporting reading the docker socket from the current docker context. If any container runtime provides a docker context, and this context is activated, then testcontainers libs will work OOTB, with no extra configuration.

You can take a look at how it looks like in the Go implementation here: testcontainers/testcontainers-go#2810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Support TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE to be read from ~/.testcontainers.properties
4 participants