diff --git a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java index 97adebcd21cac..6df970fed16c1 100644 --- a/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java +++ b/qa/packaging/src/test/java/org/elasticsearch/packaging/util/docker/DockerRun.java @@ -29,6 +29,9 @@ */ public class DockerRun { + // Use less secure entropy source to avoid hanging when generating certificates + private static final String DEFAULT_JAVA_OPTS = "-Djava.security.egd=file:/dev/urandom"; + private Distribution distribution; private final Map envVars = new HashMap<>(); private final Map volumes = new HashMap<>(); @@ -112,6 +115,11 @@ String build() { // Limit container memory cmd.add("--memory " + memory); + // Add default java opts + for (String envVar : List.of("CLI_JAVA_OPTS", "ES_JAVA_OPTS")) { + this.envVars.put(envVar, this.envVars.getOrDefault(envVar, "") + " " + DEFAULT_JAVA_OPTS); + } + this.envVars.forEach((key, value) -> cmd.add("--env " + key + "=\"" + value + "\"")); // Map ports in the container to the host, so that we can send requests