紀錄一下如何用 Dockerfile 設定 Docker images 的 locale.
以設成 en_US.UTF-8
為範例的 Dockerfile 如下:
FROM ubuntu:20.04
RUN \
# Update APT info
apt update; \
# Install required package
apt install -y locales; \
# Set the locale
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen; \
# Last line of installation and clean apt cache
rm -rf /var/lib/apt/lists/* && apt clean && apt autoclean; \
# Last Line of Docker RUN command
:;
# Configure environemnt variables
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8"
WORKDIR "/root/"
Docker
Written on
December
8th,
2021
by
Borting