且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

UTF-8编码在Docker中不起作用

更新时间:2023-11-27 21:21:52

您可以使用以下命令进行检查:设置Java参数,然后尝试运行Java程序-

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

如果使用上述命令可以工作,请使用 ENV 命令进行设置

If it worked using above command, set it using an ENV command during docker image build.

此外,如果需要在bash_profile中进行设置,请参考以下Dockerfile部分-

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