Agregar export utf8 a /etc/profile no funciona

Agregar export utf8 a /etc/profile no funciona

Intentando configurar la configuración regional en debian: estirar a utf8. Construyo una imagen acoplable que luego uso. Aparte de mi 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

Trabajo de Gitlab que usa la imagen 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=

No entiendo por qué no se cambia. No parece leer el /etc/profilearchivo.

Respuesta1

Para citar la bash(1)página del manual:

Cuando se invoca bash como un shell de inicio de sesión interactivo, o como un shell no interactivo con la --loginopción, primero lee y ejecuta comandos del archivo /etc/profile, si ese archivo existe.
Después de leer ese archivo, busca ~/.bash_profile, ~/.bash_loginy ~/.profile, en ese orden, y lee y ejecuta comandos desde el primero que existe y es legible. La --noprofileopción se puede utilizar cuando se inicia el shell para inhibir este comportamiento.

<…>

Cuando se inicia un shell interactivo que no es un shell de inicio de sesión, bash lee y ejecuta comandos desde /etc/bash.bashrc y ~/.bashrc, si estos archivos existen. Esto se puede inhibir usando la --norcopción. La --rcfileopción de archivo obligará a bash a leer y ejecutar comandos desde un archivo en lugar de /etc/bash.bashrcy ~/.bashrc.

información relacionada