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
Table of contents Common key aliases Key without ...
In one sentence: Data hijacking (Object.definePro...
Table of contents 1. Concepts related to stored p...
describe When calling this interface, you need to...
The following code introduces Chrome's monito...
My environment: 3 centos7.5 1804 master 192.168.1...
Directly code: select 'bigint unsigned' a...
This is the effect to be achieved: You can see th...
Problem description: Recently, there is a demand ...
<br />The official version of Baidu Encyclop...
Copy code The code is as follows: <span style=...
Enable remote access rights for mysql By default,...
1. InnoDB storage engine must be used It has bett...
Let's take a look at the command to restart t...
Table of contents 1. What is a JavaScript engine?...