I have found a very nice method ...withCreateContainerCmdModifier(cmd -> cmd.withCpusetCpus("0-4")); which exactly solves our problem related to an Oracle XE container (does not run on an machine with 48 core's). Unfortunately the withCpusetCpus method is marked deprecated.
Questions:
docker run --cpuset-cpus string ...) limitation which I might not have seen yet in Testcontainers?Hi @khmarbaise,
This method is from docker-java, not Testcontainers. As many other methods on CreateContainerCmd, they are aliases to getHostConfig().withCpusetCpus("0-4") (not deprecated). They were deprecated to keep CreateContainerCmd interface small and better aligned with the Docker API where such methods only exist on HostConfig object and not CreateContainerCmd payload.
Hi @bsideup,
first thanks for your hint regarding the docker-java. One question kept: Is there a better solution not to go via withCreateContainerCmdModifier(cmd -> cmd.withCpusetCpus("0-4"));.
Unfortunately I haven't seen a way to get the HostConfig and set the cpuset there (Maybe I'm just blind).
Currently we are using:
new GenericContainer<>(getDatabaseImage()).withExposedPorts(...)
.withStartupAttempts(..)
.withStartupTimeout(..)
.withCreateContainerCmdModifier(cmd -> cmd.withCpusetCpus("0-4"));
@khmarbaise
you can use the same method:
.withCreateContainerCmdModifier(cmd -> {
cmd.getHostConfig().withCpusetCpus("0-4");
});
Hi @bsideup, outch Ok ...I was blind. Many thanks for your help.
@khmarbaise happy to help! :)