testcontainers-java: Question: Should containers/networks be pruned after failed tests?
Hi all, appologies if this is a totally stupid question. I just started to work on a project that uses testcontainers for integration testing. Unfortunately on my Mac the tests all fail, whereas they succeed for other. In my case the fail because of
11:32:45.603 [Test worker] ERROR ?? [alpine/socat:latest] - Could not start container
org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container SOME_CONTAINER as it is not running
When I use ‘docker-machine ls’ , ‘docker container ls’ and ‘docker network ls’ after the failed test, the docker machine is still running, as well as the containers are.
I wonder if the containers and network should have been stopped and pruned after the failed test. They seem to be stopped and pruned if the test succeed.
Software used: testcontainers: 1.7.1 Docker vor Mac: 18.03.1-ce-mac65 Docker compose: 1.21.1 Docker machine: 0.14.0 Virtual Box: 5.1.2
I already queried the docs/how to, but I could not really find a hint. Thanks for any pointers!
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 16 (8 by maintainers)
Commits related to this issue
- Upgrade docker-compose image to latest version and perform direct image pull Together with using Compose file 2.1 syntax, this is a solution to network cleanup issue described in: * #1767 * #739 *... — committed to testcontainers/testcontainers-java by deleted user 5 years ago
- Upgrade docker-compose image to latest version and perform dire… (#1847) * Upgrade docker-compose image to latest version and perform direct image pull Together with using Compose file 2.1 syntax,... — committed to testcontainers/testcontainers-java by rnorth 5 years ago
I’ll check this @bsideup
Thanks a lot for your quick help!
I can also approve that this issue still happens with the latest java-test-containers(1.12.4) on macOS Catalina, JDK 1.8(v231), docker version 19.03.5 with maven. Adding custom code to invoke ‘docker network prune -f’ helps avoid this:
@rnorth Yes, this is still an issue on Mac. Java 13/latest testcontainers/gradle 6. Works after manual network prune from terminal after each test run.
Log here if it is of any help