1. Run fonts, open the font folder, and find the font file you want to use; 2. Modify Dockerfile, for example: FROM alpine-jdk ADD ./test.jar /opt/App/test.jar #Copy the font file COPY ./simhei.ttf /usr/share/fonts/simhei.ttf #Set character set ENV LANG en_US.UTF-8 #Install font software and complete font configuration RUN apk add --update ttf-dejavu fontconfig && rm -rf /var/cache/apk/* WORKDIR /opt/App/ EXPOSE 8080 ENTRYPOINT ["java", "-jar"] CMD ["test.jar"] Supplement: Dockerfile builds Alpine image/Linux uses apk to download and set resources (font package/other) failure/difficulty Note before buildingIf this error is reported:
Please delete "exec-opts": ["native.cgroupdriver=systemd"] in daemon.json Personal ProblemsWhen I use Dockerfile to build an image, I use the Alpine version of the base image package, and the build is always stuck. [INFO] fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz [INFO] fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz Download it here through this address, and then it will start to report an error if it fails to download.
or
After trying to modify the Docker image source and failing, I started looking for other image sources. CauseThe source address of the alpine APK mirror is in the /etc/apk/repositories file. It is a foreign mirror with an impressive download speed. It takes more than half an hour to download a few hundred KB. So we need to change the address to the domestic Ali source Solve DemoFROM adoptopenjdk/openjdk8-openj9:alpine-slim MAINTAINER ****************@*****.com RUN mkdir -p /cim-railway/auth #Use the verification code font package for testing. The first step is to replace the apk source with the domestic Alibaba source. Without the first step, the download will be difficult to produce RUN echo -e 'https://mirrors.aliyun.com/alpine/v3.6/main/\nhttps://mirrors.aliyun.com/alpine/v3.6/community/' > /etc/apk/repositories \ && apk update \ && apk upgrade \ && apk --no-cache add ttf-dejavu fontconfig When building images without Docker Just replace the two lines of mirror addresses in the /etc/apk/repositories file with the following addresses
The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: How to use the Marquee tag in XHTML code
<br />I just saw the newly revamped ChinaUI....
Let me tell you about a recent case. A game log l...
An image link <img src="" /> I wa...
Today I learned a new CSS special effect, the wav...
Use canvas to create graphics and text with shado...
1. What is the hyperlink icon specification ?<...
The HTML specification document introduces the cr...
This article example shares the specific code of ...
Table of contents Overview Virtual Dom principle ...
Often, after a web design is completed, the desig...
Preface Recently, part of the company's busin...
Online Preview https://jsrun.pro/AafKp/ First loo...
Table of contents Preface Setting up with Vue CLI...
Preface MySQL version 8.0.23 adds a new feature: ...
If your web application runs on only one machine,...