使用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)

查看:232
本文介绍了使用Ubuntu Containers(ascii,utf-8)在docker(Python,Java,Ruby,...)中运行应用程序时的编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我自己的PC上,应用程序运行不错,但是当它被部署到docker时,它会因为无效的字符而失败。



我正在使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆