我正在使用 Docker 映像并正在构建一个 dockerfile。文件locale.gen
(来自/etc/locale.gen
)包含注释#
以及语言:
ca_ES.UTF-8 UTF-8 # Catalan (Spain)
de_DE.UTF-8 UTF-8 # German (Germany)
el_GR.UTF-8 UTF-8 # Greek (Greece)
en_GB.UTF-8 UTF-8 # English (United Kingdom)
en_NZ.UTF-8 UTF-8 # English (New Zealand)
en_US.UTF-8 UTF-8 # English (United States)
eo UTF-8 # Esperanto
es_AR.UTF-8 UTF-8 # Spanish (Argentina)
es_ES.UTF-8 UTF-8 # Spanish (Spanish)
es_UY.UTF-8 UTF-8 # Spanish (Uruguay)
eu_ES.UTF-8 UTF-8 # Basque (Spain)
fr_FR.UTF-8 UTF-8 # French (France)
it_IT.UTF-8 UTF-8 # Italian (Italy)
ja_JP.UTF-8 UTF-8 # Japanese (Japan)
ka_GE.UTF-8 UTF-8 # Georgian (Georgia)
ko_KR.UTF-8 UTF-8 # Korean (Korea)
mi_NZ.UTF-8 UTF-8 # Maori (New Zealand)
nl_NL.UTF-8 UTF-8 # Dutch (Netherlands)
pt_BR.UTF-8 UTF-8 # Portuguese (Brazil)
pt_PT.UTF-8 UTF-8 # Portuguese (Portugal)
ro_RO.UTF-8 UTF-8 # Romanian (Romania)
ru_RU.UTF-8 UTF-8 # Russian (Russia)
uk_UA.UTF-8 UTF-8 # Ukranian (Ukraine)
xh_ZA.UTF-8 UTF-8 # Xhosa (South Africa)
zh_CN.UTF-8 UTF-8 # Chinese (China)
如果我运行 simple command locale-gen
,它会因为注释而失败,这就是为什么我必须使用 option awk -F "#" '{print $1}'
,但它仍然失败。
在 dockerfile 中查看它的样子:
# ?? Setting the system keyboard and language
# ?? A definir o idioma e o teclado do sistema
COPY ./config/languages/locale-minimal.gen /etc/locale.gen
RUN locale-gen | awk -F "#" '{print $1}'
我建议您考虑更改 Docker 文件以复制源文件,然后对其进行修改:
如果您不想在 Docker 实例中保留原始副本,则可以将其复制并就地编辑: