head: cannot open '/etc/ssl/certs/java/cacerts' for reading: No such file or directory in Debian Image Java 11
Asked Answered
D

3

14

I have written a dockerfile for creating selenium image with debian base image While I am installing JDK11,I am seeing these errors.enter image description here

RUN apt-get upgrade
RUN apt-get update
RUN apt-get -y install apt-transport-https curl
RUN apt-get -qqy --no-install-recommends install bzip2
RUN apt-get -qqy --no-install-recommends install ca-certificates
RUN mkdir -p /usr/share/man/man1
RUN apt-get -qqy --no-install-recommends install openjdk-11-jre-headless
RUN apt-get -qqy --no-install-recommends install ca-certificates-java
RUN dpkg --list | grep java
RUN apt-get -qqy --no-install-recommends install sudo
RUN apt-get -qqy --no-install-recommends install unzip
RUN apt-get -qqy --no-install-recommends install gdebi-core
COPY files/chrome/google-chrome_amd64.deb /google-chrome_amd64.deb
RUN gdebi --n /google-chrome_amd64.deb
RUN apt-get -qqy install xvfb
RUN rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN echo $(ls ./usr/lib/jvm/java-11-openjdk-amd64/lib/security)

This is the docker file i am using

Daughterly answered 19/4, 2020 at 14:13 Comment(1)
A note in passing: try to reduce the number of layers in your image by minimizing the number of separate RUN commands in your Dockerfile.docs.docker.com/develop/dev-best-practicesSpritsail
R
8

Seems related to this bug:
https://bugs.launchpad.net/ubuntu/+source/ca-certificates-java/+bug/1998065

Try to install ca-certificates-java before java, e.g.:

apt-get install ca-certificates-java openjdk-11-jre-headless
Rocket answered 17/5, 2023 at 16:18 Comment(0)
U
4

It's some layering issue I read somewhere else online. Don't know much about that. But that pointed me toward a usable fix: remove the folder and recreate it.

rmdir /etc/ssl/certs/java
mkdir /etc/ssl/certs/java

Now the install should work.

Unprofitable answered 29/11, 2022 at 22:25 Comment(0)
M
0

It works for me (important the two separated RUN commands in this order)

RUN apt-get install -y ca-certificates-java
RUN apt-get install -y default-jdk
Monogenesis answered 6/8 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.