Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 为Dockerfile中的所有案例设置区域设置和时区_Ubuntu_Docker_Debian - Fatal编程技术网

Ubuntu 为Dockerfile中的所有案例设置区域设置和时区

Ubuntu 为Dockerfile中的所有案例设置区域设置和时区,ubuntu,docker,debian,Ubuntu,Docker,Debian,我试图涵盖Dockerfile中设置区域设置和时区的所有情况。我写了以下内容,但感觉有些过分: # Set for current session ENV LC_ALL="en_US.UTF-8" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US.UTF-8" \ TZ="UTC" # Install locales # Uncomment en_US.UTF-8 locales in /etc/locale.gen file RUN

我试图涵盖Dockerfile中设置区域设置和时区的所有情况。我写了以下内容,但感觉有些过分:

# Set for current session
ENV LC_ALL="en_US.UTF-8" \
    LANG="en_US.UTF-8" \
    LANGUAGE="en_US.UTF-8" \
    TZ="UTC"

# Install locales
    # Uncomment en_US.UTF-8 locales in /etc/locale.gen file
RUN sed --in-place '/en_US.UTF-8/s/^# //' /etc/locale.gen && \
    # Generate new locales from /etc/locale.gen file
    locale-gen && \
    # Set system locale for login shells
    echo "export LC_ALL=en_US.UTF-8" >> /etc/profile && \
    echo "export LANG=en_US.UTF-8" >> /etc/profile && \
    echo "export LANGUAGE=en_US.UTF-8" >> /etc/profile && \
    # Set system timezone for login shells
    echo "export TZ=UTC" >> /etc/profile && \
    # Set system locale for non-login shells for root
    echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc && \
    echo "export LANG=en_US.UTF-8" >> ~/.bashrc && \
    echo "export LANGUAGE=en_US.UTF-8" >> ~/.bashrc && \
    # Set system timezone for non-login shells for root
    echo "export TZ=UTC" >> ~/.bashrc
正如你所看到的,我试图(为bash ofc)报道:

  • 本届会议
  • 所有用户的登录shell
  • 所有用户的非登录shell
以上是不是太过分了?不对?是否有更合适的方式涵盖所有案例