The JVM reads several defaults from the host at startup: CPU count, filesystem behavior, locale and time zone. A laptop and a production container usually differ on all four, and tests only run against one of them.
Character encoding
On JDK 17 and earlier, the default charset follows the OS locale. Slim base images often leave LANG unset, so the JVM falls back to US-ASCII (reported as ANSI_X3.4-1968 ). Any getBytes() , new FileReader(file) or new String(bytes) call without a charset then replaces non-ASCII characters with ? , and no exception is thrown.
JDK 18 (JEP 400) made UTF-8 the default for file contents, but two things still follow the locale. File names use sun.jnu.encoding , so Path.of("résumé.pdf") throws InvalidPathException in a POSIX-locale container. System.out uses stdout.encoding (JDK 19+), so log output can be garbled while file output is correct.
Pass StandardCharsets.UTF_8 explicitly and set LANG=C.UTF-8 in the Dockerfile.…