Dockerfile buildpack-deps:jessie 基础镜像修改代码集和时区
修改代码集
# Ensure UTF-8 locale
# Set the locale
RUN apt-get clean && apt-get update
RUN apt-get install locales
RUN locale-gen en_US.UTF-8
#COPY locale /etc/default/locale
RUN locale-gen zh_CN.UTF-8 &&\
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
RUN locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
ENV LC_ALL zh_CN.UTF-8
修改时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
或者:
# Set the timezone.
RUN sudo echo "Asia/Shanghai" > /etc/timezone
RUN sudo dpkg-reconfigure -f noninteractive tzdata
参考:
https://segmentfault.com/a/1190000005026503
http://stackoverflow.com/questions/39760663/docker-ubuntu-bin-sh-1-locale-gen-not-found
本文介绍如何通过Dockerfile配置支持UTF-8编码的中文环境,并设置上海时区。具体步骤包括安装locales包并生成指定语言环境,设置环境变量以启用中文支持,以及配置系统的时区。
975

被折叠的 条评论
为什么被折叠?



