Tentando definir o local em debian: stretch para utf8. Eu construo uma imagem docker que uso. Além do meu Dockerfile:
# Set locale
RUN sed --in-place '/en_US.UTF-8/s/^# //' /etc/locale.gen && \
locale-gen && \
# Set system locale (add line)
echo "export LANG=en_US.UTF-8" >> /etc/profile && \
# Set system timezone (add line)
echo "export TZ=UTC" >> /etc/profile
Trabalho do Gitlab que usa a imagem que construí:
$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
if [ "${PS1-}" ]; then
if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
export LANG=en_US.UTF-8
export TZ=UTC
$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Não entendo por que não está sendo alterado. Parece não ler o /etc/profile
arquivo.
Responder1
Para citar a bash(1)
página do manual:
Quando o bash é invocado como um shell de login interativo ou como um shell não interativo com a
--login
opção, ele primeiro lê e executa comandos do arquivo/etc/profile
, se esse arquivo existir.
Depois de ler esse arquivo, ele procura~/.bash_profile
,~/.bash_login
, e~/.profile
, nessa ordem, e lê e executa comandos do primeiro que existe e é legível. A--noprofile
opção pode ser usada quando o shell é iniciado para inibir este comportamento.<…>
Quando um shell interativo que não é um shell de login é iniciado, bash lê e executa comandos de
/etc/bash.bashrc
e~/.bashrc
, se esses arquivos existirem. Isso pode ser inibido usando a--norc
opção. A--rcfile
opção file forçará o bash a ler e executar comandos de file em vez de/etc/bash.bashrc
e~/.bashrc
.