When I build image and check locale from container

mvn spring-boot:build-image
docker run myimage
docker exec -it <id> locale

I got

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

My app fails on non ASCII string

java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: ...
at java.base/sun.nio.fs.UnixPath.encode(Unknown Source)
at java.base/sun.nio.fs.UnixPath.(Unknown Source)
at java.base/sun.nio.fs.UnixFileSystem.getPath(Unknown Source)
at java.base/java.nio.file.Path.resolve(Unknown Source)

UTF-8 charset fixes error

docker run -e LANG=C.UTF-8 myimage

It would be nice and in accordance with docker best practice (minimal run configuration) to add the ability to add docker layer with user's custom ENV instructions.

Comment From: scottfrederick

The mvn spring-boot:build-image goal integrates with Cloud Native Buildpacks, and uses Paketo buidpacks by default. Paketo documentation shows how to configure environment variables for a generated image, and the Spring Boot Maven documentation shows an example of configuring this in your pom.xml.

As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. This feels like a question that would be better suited to Stack Overflow, so please follow up with any questions there.

Comment From: vananiev

I can’t thank you enough! I add your answer to Stack Overflow.