Skip to content
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

Error in the hyper legacy client: client error (Connect) on Windows #627

Closed
tamaroning opened this issue May 9, 2024 · 5 comments
Closed
Labels
question Further information is requested

Comments

@tamaroning
Copy link

Hello, I got this error when attempting to start a container on Windows.

Error:

thread 'foo' panicked at C:\Users\<me>\.cargo\registry\src\index.crates.io-6f17d22bba15001f\testcontainers-0.16.7\src\runners\async_runner.rs:204:29:
Error in the hyper legacy client: client error (Connect)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 

I have installed Docker Desktop on Windows and Docker on WSL2.
~/.testcontainers.properties or DOCKER_HOST were not set.

I have read the docs but could not find what values I should set.
How can I fix the error? Thank you in advance.

@DDtKey DDtKey added the question Further information is requested label May 9, 2024
@DDtKey
Copy link
Collaborator

DDtKey commented May 9, 2024

Hi @tamaroning 👋

For Windows the default socket is npipe:////./pipe/docker_engine. But that's should be overridden, since you use WSL.
You can try to set DOCKER_HOST=tcp://localhost:2375. Don't really remember defaults for Windows+WSL setup, but if this doesn't help, you will need expose the docker through TCP socket manually.

We definitely need to improve the documentation to cover this topic better.

@DDtKey
Copy link
Collaborator

DDtKey commented May 14, 2024

Please, let me know if it solves your issue.

@inahga
Copy link

inahga commented May 14, 2024

For anyone else driving by, the same is necessary on MacOS with Colima (and presumably any non-Docker container VM). I used export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock". I don't recall having to do this for older versions of testcontainers-rs, but it's not a big deal to throw this in ~/.zshrc.

@DDtKey
Copy link
Collaborator

DDtKey commented May 15, 2024

I don't recall having to do this for older versions of testcontainers-rs, but it's not a big deal to throw this in ~/.zshrc

Yes, that's because we got rid of CLI client, which was more like a temporary solution from the very beginning (with its pros and cons)


Just in order to extend the context:

Now we utilize Docker compatible API, and docker host resolution was described in migration guide for 16.0.0 version and also mentioned in docs.rs (as well as docker authentication process)

Not exhaustive list of benefits:

  • that's more flexible and allows to use remote docker or dedicated one for testing (especially common in CI)
  • we have an aligned interface, much easier to use and maintain
  • we don't need to have docker CLI locally to run tests (or any other CLI)
  • Testcontainers works this way for other languages too, so you can run test-suites written in different languages with the same config

And the main cost for that is the additional configuration only in some cases.

Reference to a similar issue: #625

@DDtKey
Copy link
Collaborator

DDtKey commented May 19, 2024

I'm going to close the issue due to inactivity.
Please, don't hesitate to re-open if you feel the provided information is insufficient.

@DDtKey DDtKey closed this as completed May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants