Open JulienBreux opened 3 weeks ago
cc @lbroudoux β€οΈ
@JulienBreux I see connections to the docker daemon to a TCP address:
Cannot connect to the Docker daemon at tcp://127.0.0.1:62541
Could it be possible that you switched from Testcontainers Cloud, which writes to the testcontainers properties file a TCP remote docker host, to plain Docker Desktop (or alternative) without using the Testcontainers Desktop app (which uses the tcd
Docker context to manage the connections)?
I have expericed something similar when I was testing host ports. I think the problem is hardcoded localhost
in https://github.com/testcontainers/testcontainers-go/blob/bca5a282a15f345b8db7c91179dcb38f74cc7a2d/port_forwarding.go#L230
I was able to fix my problem by changing localhost
to sshdC.Host(ctx)
like in wait.ForListeningPort
https://github.com/testcontainers/testcontainers-go/blob/bca5a282a15f345b8db7c91179dcb38f74cc7a2d/wait/host_port.go#L83
And I think that the ssh container should idealy set WaitingFor: wait.ForListeningPort(sshPort)
in its setup
https://github.com/testcontainers/testcontainers-go/blob/bca5a282a15f345b8db7c91179dcb38f74cc7a2d/port_forwarding.go#L153-L158
It's weird, as I'm on a Mac too and I do not see this error. Could you share more about your scenario if possible?
For me a simple:
/usr/local/go/bin/go test -timeout 60s -run ^TestExposeHostPorts$ github.com/testcontainers/testcontainers-go -v
Docker Desktop
I think that interface/ip address which used for exposed ports (in this case ssh port) is configurable in docker and is not guaranteed that it will be localhost on every system.
Testcontainers version
0.31.0
Using the latest Testcontainers version?
Yes
Host OS
macOS Sonoma 14.5
Host arch
ARM
Go version
1.22.4
Docker version
Docker info
What happened?
Just run
/usr/local/go/bin/go test -timeout 60s -run ^TestExposeHostPorts$ github.com/testcontainers/testcontainers-go -v
Relevant log output
Additional information
No response