Docker cannot display verification code after using openjdk image

Error report details:

java.lang.NullPointerException: null

problem analysis:

图形验证码依赖了系统组件,openjdk镜像源中缺少相关依赖,需要安装。

Solution:
The contents of the Dockerfile are as follows:

FROM openjdk:8-jdk-alpine
RUN apk add --update --no-cache ttf-dejavu fontconfig && rm -rf /var/cache/apk/*
RUN apk add --no-cache bash
COPY app.jar /app.jar
ENV JAVA_OPTS="-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
ENTRYPOINT ["/bin/bash", "-c", "java -Duser.timezone=GMT+08 -jar /app.jar"]

Build the image:

docker build -t app .

run:

docker run -itd --name app -p 80:80 app

Access test, verification code displays normally

Guess you like

Origin blog.csdn.net/LSW1737554365/article/details/134507128
Recommended