JEECG deployment: the problem of Alpine image

In this article, I want to remember the problems of using Alpine image in JEECG deployment.


FROM nginx:1.18-alpine


RUN  apk update \
     && apk add openjdk8-jre-base \
     && touch /etc/init.d/ \
     && chmod +x /etc/init.d/ \
     && echo "#!/bin/sh  " >> /etc/init.d/ \
     && echo "/usr/sbin/nginx  -c /etc/nginx/nginx.conf" >> /etc/init.d/ \
     && echo " java -jar /jeecgboot.jar   " >> /etc/init.d/

ADD jeecg-boot-module-system-2.2.0.jar jeecgboot.jar
ADD dist/ /usr/share/nginx/html/
ADD default.conf /etc/nginx/conf.d/default.conf

EXPOSE 80 8080
ENTRYPOINT /bin/sh -c   /etc/init.d/


server {
        listen       80;
        location ^~ /jeecg-boot {
        proxy_pass    ;
        proxy_set_header        Host;
        proxy_set_header        X-Real-IP \$remote_addr;
        proxy_set_header        X-Forwarded-For \$proxy_add_x_forwarded_for;
    location / {
       root   /var/www/html/;
        index  index.html index.htm;
        if (!-e \$request_filename) {
            rewrite ^(.*)\$ /index.html?s=\$1 last;
    access_log  /var/log/nginx/access.log ;

Post startup issues

Reason and tentative correspondence

Take a look at the class name of NoClassDefFound sun.awt , probably using Oracle's JDK can solve the problem. Because Oracle's JDK is based on GLIBC, Alpine has to leave it first. This is probably because there is a very rough Dockerfile in the source code of JEECG, which is based on CentOS7. So we can directly fix the problem by changing the Dockerfile to CentOS based.


It seems that you can solve the problem of Font by installing APK add TTF dejavu. You will continue to confirm later.

Tags: Nginx Oracle JDK Java

Posted on Thu, 04 Jun 2020 10:22:59 -0700 by Onle