-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Enhancement]: Support different docker context #5837
Comments
Require docker-java/docker-java#1946 |
@diegolovison I think you are using Colima, right? Check the docs on how to set the env vars. |
It would be very nice, if Colima would be detected automatically, just like Docker-Desktop is. I assume this is not a political thing 😘 |
@t1 I think this assumption is correct. My efforts so far about implementing support for Docker contexts have been well received by the maintainers. I am working on a pull request for docker-java here. Hope to be able to finish it up soon. I am also blogging a bit about my progress, starting here. |
Is there any update on this? The relevant PR in docker-java was merged a couple of weeks ago and I think they've done a release 3.3.0 with that change included. Do we just need a new release of testcontainers-java to pick this change up? |
Oh cool, I missed that – indeed 3.3.0 seems to include it. And the dependency in testcontainers-java was also bumped. So yeah, I guess that's what we need! |
@eddumelendez would you be able to publish a new release? (Alternatively, when does the Testcontainers project have a release scheduled next?) |
I build custom release locally, but it does not work out of box, so anyway some adjustment need to be done to make it work before release |
@piotrwielgolaski-tomtom Could you provide some details on what you tried and in what you saw? |
@skagedal my scenario was simple, use docker context to connect with remote docker instance. |
I take another swing on this and simple change in EnvironmentAndSystemPropertyClientProviderStrategy https://github.com/piotrwielgolaski-tomtom/testcontainers-java/blob/de1324ed2800eff4da326d0c23d281399d006bc0/core/src/main/java/org/testcontainers/dockerclient/EnvironmentAndSystemPropertyClientProviderStrategy.java#L51
make it work a bit more, but you need to opt in for @skagedal I noticed that you focused on docker host, but all TLS is missing, so when I use remote connection over tcp with tls it will not work. It would be lovely if docker-java also support resolution of getSSLConfig based on context |
@piotrwielgolaski-tomtom Right, there is a |
Oh, there is a I never found any complete documentation on this format, does anyone know what that might be? |
@skagedal The best that I can find https://github.com/docker/cli/blob/a0756c3c2cacebf5e5dc6454cc280c3ddf675176/docs/reference/commandline/context_inspect.md?plain=1#L42 |
And what would it expect to find in that path? |
I would expect that whatever docker expects to configure SSL https://github.com/skagedal/docker-java/blob/88cea47d18cce4339a202ae7ad66fe68ee00d533/docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java#LL450C58-L450C72 |
Now that 1.8.0 is out which uses docker-java 3.3, is this supposed to work out of the box? It's not working for me but maybe I'm doing something wrong. |
It does not work out of box, I wrote details above.
|
Ah cool — is there a PR open for that last bit? Is that something I can work around as a user without forking testcontainers? |
This is related to testcontainers#5837, though I'm not sure if it fully fixes it. This makes two changes that make testcontainers work with Colima with no configuration for me: - Since v3.3 docker-java supports looking in the context file to discover the Docker host, but EnvironmentAndSystemPropertyClientProviderStrategy ignored that. This change makes it so that if `DefaultDockerClientConfig.Builder.build` ever returns a non-default docker-host, it is used. - With Colima, the path that you use to refer to the docker socket when setting up container volumes is different from the path you use to directly connect to Docker, because within the VM, you just use the standard `/var/run/docker.sock`. Add some hardcoded logic to always use `/var/run/docker.sock` if the chosen socket appears to be from Colima; you can always override with $TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE.
While I don't know if this supports all context use cases, #6927 is sufficient to support Colima without any configuration. |
FYI in the latest build of
If |
what is the current status? |
This could be related |
Module
Core
Proposal
When I execute my test
The text was updated successfully, but these errors were encountered: