有没有办法从测试容器中传递 GenericContainer 中的 docker 标志

Is there a way to pass docker flags in GenericContainer from test containers

有没有办法在测试容器库的 GenericContainer 对象中通过此命令传递这些标志?

docker container run \
   --publish 9092:9082 \
   --detach \
   --name h2 \
   nemerosa/h2

@ClassRule
public static GenericContainer h2db =
            new GenericContainer("nemerosa/h2")
             .withStartupTimeout(Duration.ofSeconds(Constants.TIMEOUT_DURATION));

为了公开端口,Testcontainers 在 GenericContainer:

上提供了一种方法
@ClassRule
public static GenericContainer h2db =
    new GenericContainer("nemerosa/h2")
      .withExposedPorts(9092)
      .withStartupTimeout(Duration.ofSeconds(Constants.TIMEOUT_DURATION));

--detach 应该是多余的,因为 Testcontainers 在后台启动它的所有容器并分离。