- 安装依赖的字符集:在 Dockerfile 中添加如下命令:
RUN apt-get update \
&& apt-get install -y locales \
&& rm -rf /var/lib/apt/lists/*
- 设置字符集:在 Dockerfile 中添加如下命令:
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
-
构建 Docker 镜像:运行 docker build 命令构建 Docker 镜像。
-
运行 Docker 容器:使用构建好的 Docker 镜像启动 Docker 容器。