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
1. Add a comment block at the beginning of the sty...
Table of contents 1. How to locate and optimize s...
Table of contents 1. Anonymous slots 2. Named slo...
(?i) means do not match case. Replace all uppercas...
Reproduce on Kali First set suid permissions for ...
Remax is an open source framework developed by An...
This article shares with you how to use the Vue s...
How is Line-height inherited?Write a specific val...
If an index contains (or covers) the values of ...
Preface Many friends who have just come into cont...
1. First create the file (cd to the directory whe...
You can often see articles about CSS drawing, suc...
Table of contents 1. What is Promise? 2. Why is t...
Public name of the page: #wrapper - - The outer e...
This article uses examples to illustrate the prin...