-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Containers not spinning up inside VSCode Container with latest Docker for Mac #283
Comments
Hi @zsiegel, thanks for raising such a detailed issue! I confirm I can reproduce the issue. I upgraded to Docker for Mac 4.0.1, Docker version 20.10.8 and had no issues. But upgrading from Docker Desktop 4.0.1 to 4.1.1 I have an issue. |
Can also be reproduced by cloning this repo and running: docker run -it \
-v $(pwd):/opt/testcontainers-node \
-v /var/run/docker.sock:/var/run/docker.sock \
node:16-bullseye sh -c "cd /opt/testcontainers-node && npm test -- generic-container -t 'should stop the container when the host port check wait strategy times out'" First thing I notice is that the host port isn't being bound. |
Seems the Java project has also run into the issue: testcontainers/testcontainers-java#4395 |
@zsiegel As a temporary workaround, I suspect that using a different wait strategy would work. |
I tried a few different wait strategies and none of them worked. From watching the docker logs it appears these containers don't even start :( I will keep an eye on the issue in docker/for-mac as I suspect that needs fixed. |
@zsiegel you won't be able to change the wait strategy of the ryuk container, so you'd need to disable it by setting this env variable: |
hmmm so I gave this a try as well and I still get nothing. If I watch the docker logs and do From what I can see when running in this wormhole situation test containers cant spin anything up at all. |
@cristianrgreco amazing thank you. I will keep an eye out so I can test this as soon as it drops. |
I gave this another try and sadly no luck! I am now on Docker for Mac 4.3.0. Output of test run on sample project within devcontainer setup is.
When I run this locally it works fine. |
@zsiegel thanks for trying. Could you please run the test with |
Here are the logs.
I also captured the logs from the Ryuk container.
|
Hi @zsiegel, apologies for the delay! I've tried this again using testcontainers 8.6.1, Docker Desktop for Mac 4.6.1, and with disabling ryuk it works:
I will look into why ryuk is not working in this setup, but in the meantime this is a workaround. |
@zsiegel So this one took me several hours to find the root cause, thanks also for your help @kiview! When you run docker-compose, it by default creates a new bridge network. Testcontainers doesn't know about this and creates containers in the default bridge network. Containers cannot talk to each other across different networks, so for example when your VS code container tries to connect via TCP to a container in the default bridge network (this is how the resource reaper works), it times out. You can simply tell Docker to use the default bridge network, update your services:
app:
...
network_mode: bridge |
@cristianrgreco this makes a ton of sense. I assume their might be an option to specify the network test containers uses? or does the usage of test containers require this bridge network implicitly? thanks! |
Could docker-compose define a |
Adding From docker documentation:
What would be nice is to be able to attach testcontainers to an existing network by it's name. So flow would be like this:
|
@sae-artem This is already possible is it not? |
I tried it like that. I have a
Then in my testcontainers'setup
In my setup, I do Maybe I didn't get how the |
The error above was caused by the fact, that Docker Compose created the
So it seems like again testcontainers can't connect to my service from my docker-compose anyway. |
My bad, it was the other testcontainer giving this error, for which I didn't specify the network. Now it all works. So to summarize, you can join an existing network Thanks for help @cristianrgreco |
Hello
We have a number of projects that utilize VS Code running in containers. We mount the host docker socket into the container so it can access the Docker for Mac instance that is running on the host machine for our tests.
Up until the most recent version of Docker for Mac everything was going well.
Currently this no longer works on
Docker for Mac 4.1.0 (69386) - Docker version 20.10.8, build 3967b7d
. I am not exactly sure what the issue is so this might need to be reported elsewhere but I figured I would start here.I have created a reproducible project here for testing if it helps.
From what I can see the ryuk container spins up but then none of the actual test containers specified run. Here is the log output with all the debug output turned on.
Please let me know if there is anything else I can provide or if maybe you have some more answers as to where this would be best reported? I feel like I have not been able to get to the root of whatever is causing this issue. Thanks!
The text was updated successfully, but these errors were encountered: