使用Ubuntu Containers(ascii,utf-8)在docker(Python,Java,Ruby,...)中运行应用程序时的编码问题 [英] Encoding Problems when running an app in docker (Python, Java, Ruby, ...) with Ubuntu Containers (ascii, utf-8)
问题描述
我正在使用 ubuntu:最新的
容器和 python3
, java
和 ruby
。
您需要正确设置区域设置 / p>
这是最小的正确Dockerfile:
FROM ubuntu:lastest
运行语言环境en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
通常的docker图像不指定区域设置。你会看到它,如果你闯入它,并执行 locale
:
sudo docker exec -i -t yowsup3 bash
资料来源: http://jaredmarkell.com/docker-and-locales/ , https://github.com/docker-library/python/issues/13
On my own PC the application runs nice, but when it gets deployed into docker, it fails because of invalid characters.
I am using the ubuntu:lastest
container and python3
, java
and ruby
.
You need to set the locale correct.
This is the minimal correct Dockerfile:
FROM ubuntu:lastest
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
The usual docker images don't specify a locales. You see it if you bash into it and execute locale
:
sudo docker exec -i -t yowsup3 bash
Source: http://jaredmarkell.com/docker-and-locales/ , https://github.com/docker-library/python/issues/13
这篇关于使用Ubuntu Containers(ascii,utf-8)在docker(Python,Java,Ruby,...)中运行应用程序时的编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!