Open moqmar opened 4 years ago
+1.
I solved it for now by adding to my Dockerfile:
USER root
RUN apt-get update && apt-get install locales-all && apt-get clean
USER docker
That supposedly installs all locales, even not necessary ones. We currently use this:
USER root
ARG LOCALES="de_DE.UTF-8"
RUN for l in ${LOCALES}; \
do sed -i -e "s/# \(${l} .*\)/\1/" /etc/locale.gen; \
done
RUN dpkg-reconfigure -f noninteractive locales
USER docker
Still it would be nice if this or something similar was available by default without a custom build.
Cool, that is indeed less drastic :) Thanks, will switch to that. *edit: actually that doesn't seem to work with thecodingmachine/php:8.0-v4-slim-apache, so switched to:
USER root
RUN apt-get update && apt-get install -y language-pack-nl && apt-get clean;
USER docker
Not sure what "doesnt' seem to work" mean exactly. We're using this for ages and various image versions just fine:
$ locale -a
C
C.UTF-8
POSIX
de_DE.utf8
0.116 sed: can't read /etc/locale.gen: No such file or directory
Ah you are right, we obviously install the locales
package before that:
USER root
RUN apt-get update \
&& apt-get install -y \
... \
locales \
... \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ARG LOCALES="de_DE.UTF-8"
RUN for l in ${LOCALES}; \
do sed -i -e "s/# \(${l} .*\)/\1/" /etc/locale.gen; \
done
RUN dpkg-reconfigure -f noninteractive locales
USER docker
Expected Behavior
Some stuff in PHP depends heavily on locales, so I'd expect locales to be supported by a general-purpose PHP container.
Current Behavior
I need to create a custom Dockerfile to install and install the neccessary locales:
Possible Solution
Add an environment variable
LOCALES="en_GB.UTF-8 de_DE.UTF-8"
that generates the locales on container start. Setting PHP_INI_INTL__DEFAULT_LOCALE can be an independent option.Context
I want to use ProcessWire, and am trying to create as few custom Docker images as possible.
Your Environment