Roman Susi
Roman Susi

Reputation: 4199

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.

Here is what as consider more or less minimal 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.

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:

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

However, dpkg -l shows it's there:

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:

/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)

I also tried find / -name 'iso_3166-1.mo', but seems like there is no such file anywhere.

Also it seems like poedit-common, which also should have mo files, is missing them, so the problem is more general.

docker -v gives

Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

Upvotes: 2

Views: 658

Answers (1)

Roman Susi
Roman Susi

Reputation: 4199

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. Before installing packages.

Of course, the size of the image can grow as a result.

Upvotes: 2

Related Questions