debian:stretch의 로케일을 utf8로 설정하려고 합니다. 그런 다음 사용하는 도커 이미지를 만듭니다. 내 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
내가 만든 이미지를 사용하는 Gitlab 작업:
$ 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=
왜 변경되지 않는지 이해가 되지 않습니다. 파일 을 읽지 못하는 것 같습니다 /etc/profile
.
답변1
매뉴얼 페이지를 인용하려면 bash(1)
:
bash가 대화형 로그인 셸 또는 옵션이 포함된 비대화형 셸로 호출되면
--login
먼저 파일이 존재하는 경우 해당 파일에서 명령을 읽고 실행합니다/etc/profile
. 해당 파일을 읽은 후 , , , 순서대로
찾아서 존재 하고 읽을 수 있는 첫 번째 명령부터 읽고 실행합니다. 이 동작을 억제하기 위해 쉘이 시작될 때 옵션을 사용할 수 있습니다 .~/.bash_profile
~/.bash_login
~/.profile
--noprofile
<…>
로그인 쉘이 아닌 대화형 쉘이 시작되면 bash는
/etc/bash.bashrc
및~/.bashrc
파일이 존재하는 경우에서 명령을 읽고 실행합니다. 이는 옵션을 사용하여 억제할 수 있습니다--norc
. file 옵션은 bash가 및--rcfile
대신 파일에서 명령을 읽고 실행하도록 합니다 ./etc/bash.bashrc
~/.bashrc