java.lang.AssertionError : Docker environment has more than 2GB free

标签 java docker testing out-of-memory

我一直在为我使用 docker 的程序创建测试。一切都运行良好,直到我在任何测试开始时突然遇到这个问题

ℹ︎ Checking the system...
    ✔ Docker version is newer than 1.6.0
    ✘ Docker environment has more than 2GB free

Test ignored.

Test ignored.

java.lang.AssertionError: Docker environment has more than 2GB free

at org.rnorth.visibleassertions.VisibleAssertions.fail(VisibleAssertions.java:437)
at org.rnorth.visibleassertions.VisibleAssertions.assertTrue(VisibleAssertions.java:129)
at org.testcontainers.DockerClientFactory.checkDiskSpace(DockerClientFactory.java:168)
at org.testcontainers.DockerClientFactory.lambda$client$1(DockerClientFactory.java:127)
at org.testcontainers.DockerClientFactory.runInsideDocker(DockerClientFactory.java:230)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:118)
at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:116)
at my.project.historyservice.MongoDBTest.<clinit>(MongoDBTest.java:24)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:156)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.get(Field.java:393)
at org.junit.runners.model.FrameworkField.get(FrameworkField.java:73)
at org.junit.runners.model.TestClass.getAnnotatedFieldValues(TestClass.java:230)
at org.junit.runners.ParentRunner.classRules(ParentRunner.java:255)
at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:244)
at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

MongoDBTest 类开始于:
public class MongoDBTest
{
  @ClassRule
  public static GenericContainer mongodb = new GenericContainer("mongo:3.6")
          .withExposedPorts(27017)
          .waitingFor(Wait.forListeningPort());

第 24 行是我称之为“new GenericContainer”的地方

我无法弄清楚可能是什么问题。我的电脑有 16GB 的 RAM,其中大约 10GB 应该是免费的。在问题出现之前,我今天成功地运行了大约 10 次测试,我尝试重新启动计算机,但没有帮助。

最佳答案

docker rmi $(docker images -q)感谢@pafede2

关于java.lang.AssertionError : Docker environment has more than 2GB free,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55005161/

相关文章:

java - 仅在第一页上显示使用 itext 生成的 pdf 中的页数

java - Java 中抽象属性的解决方法

java - 是否可以使用 getter/setter 方法映射成员?

java - 如何从另一个类调用方法函数?

mysql - 创建一个简单的dot net core和mysql docker容器组合

docker - 无法在 Vagrant 上安装 Kubernetes

user-interface - 自动化 GUI 测试 : Meeting Us Halfway

sql-server - 如何使用Docker和Docker Compose从备份开始自动创建和运行 “clean” SQL Server数据库?

ios - XCTestCase for ios的XCTestSuite

testing - 这是面试软件测试员时要问的一个很好的面试问题吗?