我想在 testcontainers 中使用仅限本地的 Docker 镜像.
代码如下所示:
new GenericContainer("rserver:latest")...
最佳答案
我知道这个答案为时已晚,但它对于有完全相同问题的其他人可能很有用。
如果您已经拥有所需的镜像,请尝试将容器的镜像拉取策略隐式设置为默认值:
GenericContainer container = new GenericContainer("someImage")
.withImagePullPolicy(PullPolicy.defaultPolicy());
默认的镜像拉取策略告诉 Docker 只有在本地不存在的情况下才从远程存储库中拉取镜像。https://stackoverflow.com/questions/50584885/