0

I've a project with spring boot 2.5.1

When I create the docker image with the following command

mvn -B spring-boot:build-image -Dspring-boot.build-image.imageName=franco -DskipTests

and then i run it with docker run franco

I see the following error

2021-06-25 10:23:11.173 ERROR 1 --- [           main] o.s.b.c.FileEncodingApplicationListener  : System property 'file.encoding' is currently 'ANSI_X3.4-1968'. It should be 'UTF-8' (as defined in 'spring.mandatoryFileEncoding').
2021-06-25 10:23:11.177 ERROR 1 --- [           main] o.s.b.c.FileEncodingApplicationListener  : Environment variable LANG is 'null'. You could use a locale setting that matches encoding='UTF-8'.
2021-06-25 10:23:11.178 ERROR 1 --- [           main] o.s.b.c.FileEncodingApplicationListener  : Environment variable LC_ALL is 'null'. You could use a locale setting that matches encoding='UTF-8'.
2021-06-25 10:23:11.397 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

How can i set this env variable using the build-image goal?

Gavi
  • 1,300
  • 1
  • 19
  • 39
  • it depends on the docker image/OS ... [here exemplary for debian/ubuntu](https://stackoverflow.com/q/28405902/592355) – xerx593 Jun 25 '21 at 10:54

1 Answers1

0

We can use the following in order to set the encoding

docker run -e JAVA_OPTS="-Dfile.encoding=UTF-8" <image_name>
Gavi
  • 1,300
  • 1
  • 19
  • 39