Docker fails with Sub-process /usr/bin/dpkg returned an error code (1)

Tags: , ,



Im having issues trying to install JRE into my docker container.

I keep getting the error message;

Processing triggers for libc-bin (2.28-10) ...
Processing triggers for systemd (241-7~deb10u1) ...
Processing triggers for ca-certificates (20190110) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.38.1+dfsg-1) ...
Errors were encountered while processing:
 openjdk-11-jre-headless:amd64
 openjdk-11-jre:amd64
 default-jre
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I scroll up the build output a bit, I also see the following issues;

Setting up default-jre-headless (2:1.11-71) ...
Setting up openjdk-11-jre-headless:amd64 (11.0.4+11-1~deb10u1) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: error: error creating symbolic link '/usr/share/man/man1/rmid.1.gz.dpkg-tmp': No such file or directory
dpkg: error processing package openjdk-11-jre-headless:amd64 (--configure):
 installed openjdk-11-jre-headless:amd64 package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of openjdk-11-jre:amd64:
 openjdk-11-jre:amd64 depends on openjdk-11-jre-headless (= 11.0.4+11-1~deb10u1); however:
  Package openjdk-11-jre-headless:amd64 is not configured yet.

dpkg: error processing package openjdk-11-jre:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of default-jre:
 default-jre depends on openjdk-11-jre; however:
  Package openjdk-11-jre:amd64 is not configured yet.

dpkg: error processing package default-jre (--configure):
 dependency problems - leaving unconfigured
Setting up ca-certificates-java (20190405) ...
head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory

My Dockerfile is very simple, but it just wont work

FROM nginx:latest

RUN apt-get update -y && apt-get install -y 
    unzip 
    wget 
    default-jre 
    nginx

It looks to be using debian buster, any help getting this to work would be greatly appreciated. I’ve been trying for days.

Answer

jre installation require man folder to exist on the server, try this:

FROM nginx:latest

RUN mkdir -p /usr/share/man/man1

RUN apt-get update -y && apt-get install -y 
    unzip 
    wget 
    default-jre 
    nginx


Source: stackoverflow