简体   繁体   English

Ubuntu 20.04 包缺少 docker 图像中的所有 mo 文件

[英]Ubuntu 20.04 packages missing all mo-files in docker image

For some reason, iso-codes package does not install it's files inside docker image.出于某种原因,iso-codes package 不会在 docker 图像中安装它的文件。

Here is what as consider more or less minimal Dockerfile:这是或多或少最小的 Dockerfile:

FROM ubuntu:20.04
ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y && apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    dpkg-reconfigure --frontend=noninteractive locales && \
    update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
RUN apt-get update && apt-get install -y iso-codes
RUN ls /usr

I have left locale-related settings in case those are relevant.我已经离开了与语言环境相关的设置,以防它们相关。 The same problem appears when I comment all but FROM and RUN apt-get update && apt-get install -y iso-codes out.当我评论除FROMRUN apt-get update && apt-get install -y iso-codes之外的所有内容时,会出现同样的问题。

Building:建筑:

docker build -t 'mytry:1' .

Now when I run the following, I do not see anything in the directory where mo-files should reside:现在,当我运行以下命令时,我在 mo 文件所在的目录中看不到任何内容:

docker run --cidfile /tmp/docker_test.cid 'mytry:1' ls -R /usr/share/locale/en/LC_MESSAGES/

However, dpkg -l shows it's there:但是, dpkg -l显示它在那里:

ii  iso-codes               4.4-1                        all          ISO language, territory, currency, script codes and their translations

And dpkg -L has some files in the directory: dpkg -L目录中有一些文件:

/usr/share/locale/en/LC_MESSAGES
/usr/share/locale/en/LC_MESSAGES/iso_3166-2.mo
/usr/share/locale/en/LC_MESSAGES/iso_3166_2.mo

What is that I am missing?我错过了什么? (I am using the specific docker run way just for simplicity. The same problem arises in the normal usage) (为了简单起见,我使用特定的docker运行方式。在正常使用中会出现同样的问题)

I also tried find / -name 'iso_3166-1.mo' , but seems like there is no such file anywhere.我也试过find / -name 'iso_3166-1.mo' ,但似乎任何地方都没有这样的文件。

Also it seems like poedit-common, which also should have mo files, is missing them, so the problem is more general.似乎也应该有 mo 文件的 poedit-common 缺少它们,所以问题更普遍。

docker -v gives docker -v给出

Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

We have found the reason:我们找到了原因:

cat /etc/dpkg/dpkg.cfg.d/excludes
# Drop all man pages
path-exclude=/usr/share/man/*

# Drop all translations
path-exclude=/usr/share/locale/*/LC_MESSAGES/*.mo

# Drop all documentation ...
path-exclude=/usr/share/doc/*

# ... except copyright files ...
path-include=/usr/share/doc/*/copyright

# ... and Debian changelogs
path-include=/usr/share/doc/*/changelog.Debian.*

In order to get locales, one should comment out the path-exclude line for /usr/share/locale/... or replace the file.为了获得语言环境,应该注释掉/usr/share/locale/...path-exclude行或替换该文件。 Before installing packages.在安装软件包之前。

Of course, the size of the image can grow as a result.当然,图像的大小可能会因此变大。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM