I'm running a Java program from within a Docker container (started with Docker Compose) and it's throwing a bunch of errors caused by UTF-8 characters (as they can't be mapped to the ASCII charset). Is there a way to enable UTF-8 encoding from the docker-compose file?
You can check by using below command to set java parameters and then try to run your java program -
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
If it worked using above command, set it using an ENV
command during docker image build.
Also if you need to set it in bash_profile, refer below portion of Dockerfile -
RUN echo "JAVA_HOME=/opt/jdk1.8.0_65" >> ~/.bash_profile