记录一次docker部署tomcat安装GBK字体
docker版本号为:Docker version 20.10.6, build 370c289
下载的官方镜像: tomcat:8.5.32
tomcat镜像使用的系统是:Debian GNU/Linux
新建目录:新建Dockerfile
FROM tomcat:8.5.32RUN apt-get update -y \&& apt-get install -y locales vim \&& echo 'zh_CN.GBK GBK' >> /etc/locale.gen \&& echo 'zh_CN.UTF-8 UTF-8' >> /etc/locale.gen \&& locale-gen
保存后执行:docker build -t tomcat:8.5.32.v1 .
注意:最后有个点。
新建docker-compose
version: '3'services:tomcat:image: tomcat:8.5.32.v1container_name: tomcatv1restart: alwaysprivileged: trueports:- 8010:8080- 1443:443volumes:- /home/docker/conf:/usr/local/tomcat/conf/- /home/docker/logs:/usr/local/tomcat/logs/- /home/docker/webapps:/usr/local/tomcat/webapps/- /etc/localtime:/etc/localtimeenvironment:- TZ=Asia/Shanghai- LANG=zh_CN.gbkdeploy:resources:limits:cpus: '0.50'memory: 16G
日志是在全局设置:
编辑/etc/docker/daemon.json
# vi /etc/docker/daemon.json "registry-mirrors": ["https://hub-mirror./"],{"exec-opts": ["native.cgroupdriver=systemd"],"log-driver": "json-file","log-opts": {"max-size": "100m","max-file": "5"},"storage-driver": "overlay2","storage-opts": ["overlay2.override_kernel_check=true"],"registry-mirrors": ["https://hub-mirror./"]}
重启docker:
systemctl daemon-reload
systemctl restart docker
确认:进入docker容器 执行 locale -a 和locale
root@5dfa14a73b50:/usr/local/tomcat# locale -aCC.UTF-8POSIXzh_CN.gbkzh_CN.utf8root@5dfa14a73b50:/usr/local/tomcat# localeLANG=zh_CN.gbkLANGUAGE=LC_CTYPE="zh_CN.gbk"LC_NUMERIC="zh_CN.gbk"LC_TIME="zh_CN.gbk"LC_COLLATE="zh_CN.gbk"LC_MONETARY="zh_CN.gbk"LC_MESSAGES="zh_CN.gbk"LC_PAPER="zh_CN.gbk"LC_NAME="zh_CN.gbk"LC_ADDRESS="zh_CN.gbk"LC_TELEPHONE="zh_CN.gbk"LC_MEASUREMENT="zh_CN.gbk"LC_IDENTIFICATION="zh_CN.gbk"LC_ALL=
如果觉得《记录一次docker部署tomcat安装GBK字体 容器系统Debian GNU/Linux》对你有帮助,请点赞、收藏,并留下你的观点哦!