Open Jasstkn opened 2 years ago
Hi @Jasstkn, neither lima nor colima are currently officially supported by Testcontainers.
A good start would be to try out if deletion works as expected if you interact directly with Ryuk (see instructions in README): https://github.com/testcontainers/moby-ryuk
Hi @Jasstkn, neither lima nor colima are currently officially supported by Testcontainers.
A good start would be to try out if deletion works as expected if you interact directly with Ryuk (see instructions in README): https://github.com/testcontainers/moby-ryuk
it doesn't work either:
2022/02/21 12:22:59 Starting on port 8080...
2022/02/21 12:23:01 Connected
2022/02/21 12:23:13 Adding {"label":{"org.testcontainers=true":true}}
2022/02/21 12:23:21 EOF
2022/02/21 12:23:21 Disconnected
2022/02/21 12:23:31 Timed out waiting for connection
2022/02/21 12:23:31 Deleting {"label":{"org.testcontainers=true":true}}
2022/02/21 12:23:31 Removed 0 container(s), 0 network(s), 0 volume(s)
I know that those alternatives aren't officially supported but I think that you can have more information where the issue can be.
Hi @Jasstkn, neither lima nor colima are currently officially supported by Testcontainers.
A good start would be to try out if deletion works as expected if you interact directly with Ryuk (see instructions in README): https://github.com/testcontainers/moby-ryuk
Is there an issue ticket or way we can promote this request? I just switched to colima and am having the normal issues as reported by others.
Are there features or known broken components that the open source community can work on? I would be happy to contribute. I just do not know if the issues are in TestContainers-Java or specifically in the Ryuk containers.
Thanks for trying this out @Jasstkn, this is very helpful. In this case, I'd say the issue might be unrelated to Testcontainers itself and has to be somewhere in the interaction between Ryuk and Lima.
@dnatic09 How does Colima not work for you? From how I understood @Jasstkn, it works fine for her with Colima and the problems are when using Lima directly. In the case of this issue, some more investigations with regards to Ryuk and Lima compatibility would be appreciated. It might be that Lima is lacking parts of a Docker compatibility layer that Colima provides, but I don't have any personal experience with either technology yet, so I can't comment on this further.
I unfortunately do not have extensive time to troubleshoot, but TestContainers cannot connect to the Ryuk container when running unit tests.
If I run Ryuk manually and port forward, I can netcat the container. If Junit5 starts the Ryuk container, I am unable to netcat the container's exposed port.
Okay. Did some testing:
brew install colima
brew install docker
Ryuk Test That Works
docker run -p 8080 -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock testcontainers/ryuk:0.3.3
nc -v localhost 8080
SUCCESS
Ryuk Test That Does NOT Work
docker run -p 8080 -v /var/run/docker.sock:/var/run/docker.sock testcontainers/ryuk:0.3.3
docker inspect [new container id]
nc -v localhost [new port]
CONNECTION REFUSED
It seems like Colima and the Docker engine are not properly forwarding the default exposed port from Ryuk back out to the host.
EDIT: So, the problem is definitely with Colima/Lima and Ryuk
Just proved it again that it is colima/lima:
Sounds like a bug in colima, as I am sure it is reproducible with at least some other images too.
I think we have seen a similar bug in Docker Desktop that got fixed (@rnorth perhaps you remember the link?)
@dnatic09 try to configure this variables: https://github.com/testcontainers/testcontainers-java/issues/5043#issuecomment-1038898766
I'll try again tomorrow, but i symlinked my Colima home directory 'docker.sock' to'/var/run/docker.sock'.
That should take care of all cases.
@dnatic09 Please try the approach outlined in the comment first, I know of a couple of different Testcontainers users that got a working setup like this.
Also, your issue seems unrelated to what @Jasstkn reported, please open a dedicated issue if it persists. Your problem seems to be related to port publishing (rather than port mapping, which you proofed to work).
@bsideup We had a similar issue in Docker for Desktop on Windows, which was due to firewall config with regards to WSL VM and lead to published ports being opened in a blocked range, but only when --publish-all
was used.
@dnatic09 Please try the approach outlined in the comment first, I know of a couple of different Testcontainers users that got a working setup like this.
Also, your issue seems unrelated to what @Jasstkn reported, please open a dedicated issue if it persists. Your problem seems to be related to port publishing (rather than port mapping, which you proofed to work).
I just removed the symlink to /var/run/docker.sock
and used the recommended environment variable settings. Same result. TestContainers can start Ryuk, but the port publishing is not working on the "host unspecified" Docker mapping.
I'm getting the same exception while using Rancher Desktop 1.1.1 on MacOS. This seems to work for a couple of first unit tests but after some time I keep getting [testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:49167
^^^ same. The issue randomly went away and then returned. Just inconsistent behavior with Lima/Colima and the port publishing. Let's just keep updating our docker environment and hope it goes away :(
Well I never had a fully successful unit test run so it's difficult to work like that ;) It seems always to be stucked after 3-4 unit tests.
Strategy of how you build tests is VERY important. I try to start only one container per test fixture and repurpose that container for ALL tests within that fixture. There are many ways to accomplish this and it requires a degree of creativity. Do not allow each micro-test to run its own version of the container. It is not even stable using Docker Desktop.
Hi!
I'm trying to debug an issue with containers cleanup after tests finished.
This problem reproduces for lima but doesn't reproduce for colima.
I found that there are some call to docker daemon:
And no errors in ryuk container just information that nothing has been deleted:
Docker info:
Any help is appreciated.