OS
Size: a a a
OS
OS
OS
OS
OS
AK
DT
AC
IZ
OS
~/.testcontainers.properties
написать testcontainers.reuse.enable=true`и потом контейнеру сказать `container.withReuse(true)
;OS
OS
OS
OS
public class Main {
public static void main(String[] args) throws Throwable {
var c = new GenericContainer("blah");
c.start();
new Scanner(System.in).nextLine();
}
}
IZ
OS
OS
OS
IZ
docker ps
перед тем как траблшутить.
private static Optional<RedisClusterClient> getExternalRedisClient() {
try {
Process p =
new ProcessBuilder(
"docker",
"ps",
"--filter",
"status=running",
"--format",
"{{.ID}}\\t{{.Image}}\\t{{.Ports}}")
.start();
p.waitFor();
return IOUtils.readLines(p.getInputStream(), StandardCharsets.UTF_8).stream()
.map(l -> l.split("\t", 3))
.filter(s -> s[1].contains("docker-test-redis"))
.map(s -> Ints.tryParse(RegExUtils.replaceAll(s[2], ".*->([0-9]+).*", "$1")))
.filter(port -> port != null)
.map(
port ->
RedisClusterClient.create(
ClientResources.builder().build(),
Collections.singleton(RedisURI.create("127.0.0.1", port))))
.findFirst();
} catch (Exception e) {
return Optional.empty();
}
}
OS